Dynamic generation of Lexical Analyzers in Java

121 views Asked by At

I want to match regular expressions very fast, low overhead. And I want to be able to choose between multiple expressions.

E.g.

AB* -> case A

XXX -> case B

etc

So I want to name all of which cases matched.

The problem is very similar to a lexical analyzer but the patterns are dynamic. That is, a user could change them at any time. So I don't have the luxuary of re-running Lex. Plus, I could have any number of different matchers.

I don't need any of the subpattern identification/capture stuff in Java or the overhead.

Just need to know which cases matched.

I could write software to do this efficiently...but it would almost be like re-writing lex.

Are there any tools that can do this?

Are there any more efficient regular expression libraries than the built in ones in java? Thread safe, etc.

thanks.

0

There are 0 answers