Re: PHP script for detecting pattern sequences?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



yes
(\d+?)\1+  works fine

On Thu, Jul 9, 2009 at 6:00 AM, Per Jessen <per@xxxxxxxxxxxx> wrote:

> 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)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Best Regards!
Wen Dong

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux