Re: OT - Regular Expression

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

 



# arpad@xxxxxxxxxxx / 2007-02-09 12:44:40 +0000:
> Roman Neuhauser wrote:
> >This shouldn't do too much backtracking, try it out:
> >
> >"*8*" => /^(?:\d*8\d*){4}$/
> >
> >  
> The {4} in there repeats the subpattern 4 times, rather than limiting it 
> to 4 characters.

OMG.  Sorry, haven't got enough sleep.

> I really can't think of an elegant to do what you ask with regex - why 
> limit yourself to regex anyway?
> It would be far simpler to just convert * to .* and check the length 
> separately with strlen(), plus if you check the length first then you 
> don't need regex at all if it fails.

Yup.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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