Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by explorer (Chaplain)
on Jul 28, 2006 at 20:36 UTC ( #564455=note: print w/ replies, xml ) Need Help??


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

You said the solution...

my $string = '---LL--C----LCSH-------CSHL-------LCSLH-------LCCHLSHCL- +---'; # 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 while ($string =~ /([CSH][CSHL]*[CSH])/g) { print "$1, "; } __OUTPUT__ CSH, CSH, CSLH, CCHLSHC,


Comment on Re: Regexp: How to match in middle but not the ends?
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://564455]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2015-07-05 21:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls