in reply to Re: Regexp: How to match in middle but not the ends?
in thread Regexp: How to match in middle but not the ends?
It incorectly matches "C" in "-C-". (Two chars minimum.)
$_ = '---LL--C----LCSH-------CSHL-------LCSLH-------LCCHLSHCL----'; while (m/([A-Z]+)/g) { ($s = $1) =~ s/^L+|L+$//g; print "$s\n" if length $s >= 2; }
|
|---|