in reply to Finding repeat sequences.
is
$str = ($pattern x $n ) . substr($pattern,0,$k)
with
0 <= $k < ($l = length($pattern))
and the task is to find maximum $pattern for a given $str to fit these constraints?
If yes, some simple mathematics should already considerably minimize the set of possible combinations you need to investigate with regexes.
Cheers Rolf
( addicted to the Perl Programming Language)
DB<109> $pattern='abcdabcdabce' => "abcdabcdabce" DB<110> $n=2,$k=2 => (2, 2) DB<111> $str = ($pattern x $n ) . substr($pattern,0,$k) => "abcdabcdabceabcdabcdabceab" DB<112> $str eq 'abcdabcdabceabcdabcdabceab' => 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Finding repeat sequences.
by hdb (Monsignor) on Jun 21, 2013 at 10:54 UTC | |
|
Re^2: Finding repeat sequences.
by BrowserUk (Patriarch) on Jun 21, 2013 at 01:24 UTC | |
by LanX (Saint) on Jun 21, 2013 at 02:22 UTC | |
by BrowserUk (Patriarch) on Jun 21, 2013 at 02:48 UTC |