[clug] Substring repetition detection

Jepri jepri at webone.com.au
Wed Jun 25 20:04:45 EST 2003


Or you could do it with one line of perl:

/((\w+)\2+)/

If you wanted perl to do it all for you then repeated applications of

s/((\w+)\2+)/$1/

should do the trick.



On 2003.06.25 17:37, David Price wrote:
> On Wed, Jun 25, 2003 at 05:27:03PM +1000, David Ananian-Cooper wrote:
> > a b c d a b c d a b z f g
> > - - - - 4 4 4 4 4 4 - - -
> >
> > here 4 >= 6, but the last 2 4's should not be considered as part of
> the
> > repeating pattern
> 
> Good point :)
> 
> I guess you'd round down to the next lowest multiple of n, where n is
> 4 in this case.
> 
> --
> David.Price at anu.edu.au
> uni phone: +61-2-612-58608  home phone: +61-2-6251-1597
> 
> 



More information about the linux mailing list