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

Re: Finding a repeating substring with a regex

by kvale (Monsignor)
on Apr 15, 2006 at 08:29 UTC ( #543510=note: print w/ replies, xml ) Need Help??


in reply to Finding a repeating substring with a regex

First you must find the repeating unit. Try this:

use re 'eval'; $_ = q'abczdefzabcghijklzabczaerabrtyuabcethdauthabkudiabc'; if (/([a-z]{3}).+?\1/) { $unit = $1; m< ( (?{ push @found, pos() }) $unit ) \G .+? \1 >gx; print join ', ', @found, "\n"; }

-Mark


Comment on Re: Finding a repeating substring with a regex
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2015-07-03 07:00 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 (48 votes), past polls