Still, as a general regex efficiency principle, you can rewrite /(?:.(?!foo))*/ as /.*?foo/. The regex engine won't go character-by-character; it'll be smart about it and jump from one "f" to the next until it finds an "f" followed by "oo". Or you could use /[^f]*(?:f(?!oo)[^f]*)*/, although I'd personally go with the simpler .*? approach.
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
In reply to Re: Regex runs for too long
by japhy
in thread Regex runs for too long
by examine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |