Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: Finding repeat sequences. (only mostly regex)

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


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

There are no gaps between the repeats, so the uncaptured .* is not required (actually mustn't be there).

And if the second rep is incomplete \1 will never match before $.

I've been trying variations on

$s = 'aaaabaaaabaaaaabaaaab';; $s =~ m[^(.+)\1*(.*?$)] and $1 =~ $2 and print "$1/$2";; aaaabaaaabaaaaabaaaab/

With the idea that any partial rep at the end can be verified again the beginning of the full rep, but it needs to happen inside the regex and cause backtracking.


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^4: Finding repeat sequences. (only mostly regex)
Download Code
Re^5: Finding repeat sequences. (only mostly regex)
by choroba (Abbot) on Jun 18, 2013 at 20:23 UTC
    The .* matches the missing part of the last incomplete repetition.
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

      No. Any incomplete rep will alway be at the end of the string. 'fredf', 'fredfr', 'fredfre', 'fredfredfre' etc.


      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.
        Right. In fredfr, the ed will be matched by the .* between the repetitions. It corresponds to the missing part of the last repetition. Or am I missing something?
        لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (12)
As of 2014-07-28 12:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (197 votes), past polls