
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 Alons
http://www.kinook.com
begin 666 regex.zip
M4$L#!!0````(`!!2+38?'+8'N0$``&<#```(````=&5S="YC<'"54LMNVS 0
M/,N _V'AJ UI"VI3]P'(;@]]H7?W%@8%(Z\E`A(E4.M81I-_[Y*6W3A%"_0@
M:K'#F1TNYL+8O-JN$9:W3=/1"X<%]FG9MA_&HXL3UG?DC"W.>AONH:ZY-QX9
M2U!K8X4OM"OR!/)2NZFO[ZYOY'CT \L^:!V/:@ZU"6D>MHEI+K>)Y3%@
M-;04&%;)1DM!%D)6B2*NVMZF7\EFLUY:CEL$DLPW"QCYH$Y49PGKO"O<43MR
MRBAF.1//U$GJ[%,GJW-2G6S!5%8$ROQE%=59S8ZJ!OR,U,3'9A5TTC"(M#7W'W-;1;,/E\VB^RF+.\IO*?PDMR6
M*;R[#]Y-/+ZC4G[U@\18@:\&:;I&0I6MIFR=8"B*M2Z#0G05LO27";^VSV#J
M_P%02P$"% `4````" `04BTV'QRV![D!``!G`P``" `````````!`" `````
M````=&5S="YC<'!02P$"% `4````" `7=2PV)0H!PZ,(```Y;P``"0``````
M```!`" ```#?`0``:6YP=70N='AT4$L!`A0`% ````@`L%$M-@P*IPFT" ``
MQ6\```H``````````0`@````J0H``&]U='!U="YT>'102P4&``````,``P"E
)````A1,`````
`
end

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.

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.
Spot on. I didn't think it could be that simple. Thanks! Kyle

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.
That works for the previous input file but not the attached one (which does
work with the older regex lib and original expression).
Kyle
begin 666 input.zip
M4$L#!!0````(`"D^.C:;2I0HHP@``#EO```)````:6YP=70N='AT[5Q?;]LV
M$']>@7X'(D\.YLIML:% VQ1(G*[-D'59G*P#@CS0$FMSE46-I))Z13_9'O:1
M]A5VU%_*IFG9M>0FEAX

Kyle Alons wrote:
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.
That works for the previous input file but not the attached one (which does work with the older regex lib and original expression).
What do you mean by "doesn't work" ? It runs to completion just fine for me, no exceptions etc. Or do you mean it produces the wrong output? (I don't know what your specific intent was for the regex, so I can't guarentee that it's 100% identical in result). John.

What do you mean by "doesn't work" ? It runs to completion just fine for me, no exceptions etc. Or do you mean it produces the wrong output? (I don't know what your specific intent was for the regex, so I can't guarentee that it's 100% identical in result).
With the original expression in v1.31, it gives the attached output. In
v1.33.1, the original expression fails with 'memory exhausted', and using
(?!System)*, specifically,
"(\\w+\\()(?!System)*System\\.Data\\.DataSet ...
or
"(\\w+\\()((?!System)*)System\\.Data\\.DataSet ...
or
"(\\w+\\()((?:!System)*)System\\.Data\\.DataSet ...
makes no replacements.
Kyle
begin 666 output.zip
M4$L#!!0````(`.0X.S:*

Kyle Alons wrote:
What do you mean by "doesn't work" ? It runs to completion just fine for me, no exceptions etc. Or do you mean it produces the wrong output? (I don't know what your specific intent was for the regex, so I can't guarentee that it's 100% identical in result).
With the original expression in v1.31, it gives the attached output. In v1.33.1, the original expression fails with 'memory exhausted', and using (?!System)*, specifically,
"(\\w+\\()(?!System)*System\\.Data\\.DataSet ...
or
"(\\w+\\()((?!System)*)System\\.Data\\.DataSet ...
or
"(\\w+\\()((?:!System)*)System\\.Data\\.DataSet ...
makes no replacements.
Doh!! Should have been using ((?:(?!System).)*) John.
participants (2)
-
John Maddock
-
Kyle Alons