in reply to Interesting behavior of regular expression engine
Instead, the code that does '.+' is optimised to know that it must be followed by a known fixed string (bcdef) and avoids consuming so many characters that the constraint can't be met.
In the second case it isn't followed by a fixed string, but rather by a '.', so the optimisation isn't triggered, and the engine falls back to a naive series of backtracks.
Dave.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Interesting behavior of regular expression engine
by lightoverhead (Pilgrim) on Mar 12, 2013 at 23:29 UTC |