in reply to Regexp: How to match in middle but not the ends?

Taking the poster's exact description, "I want to loop through these strings and find maximal sets of two or more of the capital letters that do not begin or end with L." I came up with this:
my $string = '---LL--C----LCSH-------CSHL-------LCSLH-------LCCHLSHCL- +---'; @patterns = $string =~ /([^-L][LCSH]*[^-L])/g; print join ', ', @patterns;
The result is this:

CSH, CSH, CSLH, CCHLSHC

Is that what you were looking for?

--marmot