Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2007-01-14 04:56:17


Kyle Alons wrote:
>> The attached sample works properly in boost v1.30.2 but fails with a
>> 'Memory exhausted' exception in v1.31 through v1.33.1. Is this a
>> bug, and/or do you have any ideas on rephrasing the expression to
>> work in boost 1.33.1? Thanks.

Kyle: the trick with these is to change the expression to make it as
unambiguous as possible: the exception is thrown when the regex state
machine visits too many states while trying to find a match and then gives
it up as a lost cause rather than risking looking indefinitely.

In this case the first (.*|\\n*) is superfluous since . can match \n as
well, so the machine can "thrash" if it encounters a lot of whitespace.
Using (?!System)* fixed the problem and brought the execution time down
enormously.

HTH, John.




Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net