Reputation: 442
I was searching for a way or tool to convert the regular expression into the ANTLR 4 expression but could not find anything suitable. Now i'm curious "Can we actually convert it or not." If not, then i assume ANTLR 4 expression and regular expression looks same look-wise but are totally different. Please correct if I'm wrong.
Upvotes: 3
Views: 713
Reputation: 51330
ANTLR lexer rules are actually regular expressions, in the formal sense. This means you won't get pattern matching features like lookahead/lookbehind/captures etc out of the box. You can insert custom code in the rules if you need more control over the matching process.
As for the syntax, it's a bit different from the standard regex syntax.
For instance, in ANTLR you write ~[a-z]
instead of [^a-z]
Upvotes: 1