My Question is the following:
Is there a Pattern-Builder in Java which can be feeded with input and builds a search/regex pattern for it?
The example:
What i have:
Load the List of names.
Start reading the file, and check each line with the full List of Names. (This creates a Cartesian product, but I don’t want that).
What i want to achieve:
Load List of Names which should be considered for the regular expressions
Create Pattern and load all the names into the pattern.
Read the first file and check it with the pattern.
So you can see that I would like to reduce the Cartesian product down to an O[n] sequence to save performance.
Conditions:
The Regular Expression pattern should be loaded from a list, so it will be dynamic.
The input can be anything, the output should be an alert in case any of the names matches.
If you think I have not provided enough please ask, ill be glad to provide more information wherever I can.
Unfortunately dasblinkenlight has put in the answer in the comments,
The results of compiling such a huge pattern is alright, i tried it with a 4.5 MB pattern. I hope there is no limitation to that.