I am writing a program in .net where the user can provide a large number of regular expressions. For a given string, I need to find out which regular expression matches this string (if there are several matches, I only need the first one that matches). However, if there are a large number of regular expressions, this operation can take a very long time.
I was somewhat hoping there would be something similar to flex (The Fast Lexical Analyzer (not Adobe Flex)) for .net, which would allow me to specify a large number of regular expressions still quickly (O (n) according to Wikipedia for n = len (line input)) find out which regular expression matches.
Also, I would prefer not to implement my own regex engine :).
source
share