Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^8: Finding repeat sequences. (Sorry!)

by BrowserUk (Pope)
on Jun 18, 2013 at 20:56 UTC ( #1039664=note: print w/ replies, xml ) Need Help??

in reply to Re^7: Finding repeat sequences. (only mostly regex)
in thread Finding repeat sequences.

I am so sorry. You've done the same flip that tye did, capturing the partial rep rather than the complete rep. Threw me completely.

With a couple of enhancements that works for the 1 rep/1 partial case:

$s = 'aaaabaaaabaaaaabaaaab';; $s =~ /^((.*).*)\2$/ and print "$1/$2";; aaaabaaaaba/aaaabaaaab

And still works for that when enhanced to allow for more than 1 complete rep:

$s =~ /^((.*).*)\1*\2$/ and print "$1/$2";; aaaabaaaaba/aaaabaaaab

But then fails when given more than one complete rep:

$s = 'aaaabaaaabaaaaabaaaabaaaaabaaaab';; $s =~ /^((.*).*)\1*\2$/ and print "$1/$2";; aaaabaaaabaaaaabaaaaba/aaaabaaaab

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
Comment on Re^8: Finding repeat sequences. (Sorry!)
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (13)
As of 2016-05-27 15:56 GMT
Find Nodes?
    Voting Booth?