Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Perl Regex Repeating Patterns

by AnomalousMonk (Abbot)
on Jan 18, 2012 at 00:07 UTC ( #948445=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Perl Regex Repeating Patterns
in thread Perl Regex Repeating Patterns

The following regex worked properly. ... If there is a better way to do this ...

Even after adding (just for the heck of it) a closing  } brace, all I get is an infinite loop. What code are you running?

>perl -wMstrict -le "my $string=\"AAABBBCCCCDDDEEEFFFGGGHHHIII\"; my @patterns=('BBB','DDD'); my @index; foreach(@patterns){ while($string=~m/\G([A-Z]{3})+?$_/g){ push(@index,$-[2]); pos($string)=$-[2]; print 0+@index; <STDIN>; } } " 1 2 3 4 5 ... Terminating on signal SIGINT(2)


Comment on Re^3: Perl Regex Repeating Patterns
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2015-07-03 02:55 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 (47 votes), past polls