Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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

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 studying the Monastery: (5)
As of 2016-09-30 21:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (574 votes). Check out past polls.