Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Perl Regex Repeating Patterns

by JavaFan (Canon)
on Jan 17, 2012 at 22:17 UTC ( #948431=note: print w/ replies, xml ) Need Help??


in reply to Perl Regex Repeating Patterns

Untested:

foreach my $pattern (@patterns) { for (my $i = 0; $i < length($string); $i += 3) { push @matches, ${^MATCH} if substr($string, $i) =~ /^$pattern/p; } }
It shouldn't be hard to adapt if you want the offsets (as your original code does). It does capture overlapping matches, although with the given patterns, no overlap is possible.


Comment on Re: Perl Regex Repeating Patterns
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (18)
As of 2014-09-22 18:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls