in reply to Regexp: How to match in middle but not the ends?
Update: I just noticed: This will fail if the string starts or ends with "L" and not with "-" or anything else. So making the $string in the split a "-$string-" is one workaround.my $string = '---LL--C----LCSH-------CSHL-------LCSLH-------LCCHLSHCL- +---'; foreach (split /L*-+L*/, $string) { print $_,"\n" if length($_)>2; }
|
|---|