tags:

views:

349

answers:

2

Are there any (free) regular expression engines for Java, that can compile a regular expression to a DFA, and do group capturing while matching the DFA ?

I've found dk.brics.automaton and jrexx, which both compile to DFA, but neither seems to be able to do group capture. While the other engines I've found seem to compile to NFA.

A: 

you can try Pat regular expressions library @ http://www.javaregex.com/ .

JerA
From the website it's at least not obvious at all, that this engine would be DFA based nor that it would support group capture. If it is, and does, could you please confirm.
Sami
That lib (Stevesoft Pat) does support capturing groups, but it's definitely **not** DFA-based.
Alan Moore
A: 

For C there is TRE and Google's RE2 libraries. TRE uses DFA, RE2 uses NFA (as far as I understand), both could subgroup matching. But I didn't see such a library for Java.

Dmitry