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. 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.

Arpad

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

Reply via email to