Hi Kevin
Using [-+]DATA\s(.*)$ fails to parse
If I use .* as the regular expression it still gives stackoverflow
message.
Sujata Patil,
"Rodgers, Kevin" <
Kevin.Rodgers@...>
12/28/2005 02:23 PM
Please respond to
"Regexp Users List" <
regexp-user@...>
To
"Regexp Users List" <
regexp-user@...>
cc
Subject
RE: Stackoverflow error
patils@... writes:
> I have to parse the following strings
>
> -DATA datavalue
> +DATA datavalue
>
> I am using the following regular expression
> ^{?:\+\\-)DATA\s*(.*)$
^
| should be (
> This gives stack overflow if the string is more than 3.6k
>
> Do you have any recommendations to resolve this issue.
I think you could simplify ^(?:\+\\-) to just [-+]
But more importantly, I think you can get rid of some potential
backtracking decision points if you know there's exactly a single
whitespace character between DATA and datavalue: DATA\s(.*)$
--
Kevin
---------------------------------------------------------------------
To unsubscribe, e-mail:
regexp-user-unsubscribe@...
For additional commands, e-mail:
regexp-user-help@...