in reply to Re^2: A NOT in regular expressions (why [^%>]?)
in thread A NOT in regular expressions
You're using the dreaded /(A+|B+)*/, a star on top of a plus. That's considered very bad for regexps, because if the pattern fails for some reason, you'll get lots of unnecessary backtracking. Jeffrey Friedl also discusses this in his book "Mastering Regular Expressions", Chapter 5 p.144 in the 1st edition (which is all I have) under the subtitle "Reality Check".(?: # Match stuff that isn't a closing delim: [^%]+ # Things that can't start one. | %+[^>] # Might start one but isn't one. )*
For it to behave properly, you should loose the plusses.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: A NOT in regular expressions (no new features?)
by tye (Sage) on May 14, 2003 at 18:09 UTC | |
by tilly (Archbishop) on May 14, 2003 at 18:40 UTC | |
|
Re^4: A NOT in regular expressions (why [^%>]?)
by Aristotle (Chancellor) on May 14, 2003 at 11:04 UTC | |
by BrowserUk (Patriarch) on May 14, 2003 at 11:28 UTC | |
|
Re: Re: Re^2: A NOT in regular expressions (why [^%>]?)
by tilly (Archbishop) on May 14, 2003 at 15:07 UTC |