Hi Kevin

Using [-+]DATA\s(.*)$ fails to parse

If I use .* as the regular expression it still gives stackoverflow 
message.


Sujata Patil,




"Rodgers, Kevin" <[EMAIL PROTECTED]> 
12/28/2005 02:23 PM
Please respond to
"Regexp Users List" <regexp-user@jakarta.apache.org>


To
"Regexp Users List" <regexp-user@jakarta.apache.org>
cc

Subject
RE: Stackoverflow error






[EMAIL PROTECTED] 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to