[antlr-interest] nongreedy parsing, how Can I?

Stanimir Stamenkov stanio at myrealbox.com
Tue Mar 14 07:41:58 PST 2006

/enriquebris at cimex.com.cu/:

> rule : (OTAG) (.)?{some code…} (CTAG)
> The problem is that the (.)? eats all characters including CTAG (>).

The (.)? will match a CTAG also, and then the rule will try to match 
one more CTAG. I guess you need to use (~CTAG)? which will match any 
token except CTAG.


More information about the antlr-interest mailing list