Re: PHP script for detecting pattern sequences?

From: Date: Wed, 08 Jul 2009 22:00:17 +0000
Subject: Re: PHP script for detecting pattern sequences?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-295050@lists.php.net to get a copy of this message
Rob Gould wrote: > Can anyone tell me if there's a PHP library out there that will help > me determine "pattern sequences" from a string? > > > Example input: > > 032258064516129032258064516129032258064516129032258064516129 > Sequence = 032258064516129 > > > 037037037037037037037037037037037037037037037037037037037037 > Sequence = 037 > > > I know regex can help you find a pattern when you know what the > pattern is already, but this is different. Nah, it's the same thing. A suitable regex might look something like this: /([0-9]+)\1+/ Not tested, probably won't work on the first try. You may need greediness adjustments. /Per -- Per Jessen, Zürich (14.1°C)

« previous php.general (#295050) next »