A
Allan Ebdrup
I have a dynamic list of regular expressions, the expressions don't change
very often but they can change. And I have a single string that I want to
match the regular expressions against and find the first regular expression
that matches the string.
I've gor the regular expressions ordered so that the highest priority is
first (if two or more regular expressions match the string I want the first
one returned)
The code that does this has to perform very well as it is called hundreds of
thousands times a day.
I was thinking of concatenating the regular expressions into one large
expression and have each expression in parenthesis so it captures. Can I
find out what expression matched the string? I know how to do this with a
function in javascript where I would check the arguments array. But how do I
accomplish the same in C# ?
Kind Regards,
Allan Ebdrup
very often but they can change. And I have a single string that I want to
match the regular expressions against and find the first regular expression
that matches the string.
I've gor the regular expressions ordered so that the highest priority is
first (if two or more regular expressions match the string I want the first
one returned)
The code that does this has to perform very well as it is called hundreds of
thousands times a day.
I was thinking of concatenating the regular expressions into one large
expression and have each expression in parenthesis so it captures. Can I
find out what expression matched the string? I know how to do this with a
function in javascript where I would check the arguments array. But how do I
accomplish the same in C# ?
Kind Regards,
Allan Ebdrup