I have regular expression like this:
“error 1|error 2|error 3|error 4|error 5”
about 80 (can be more) miscelanous error messages
Now I check if in my text error message exists:
Regex errorRegex = new Regex("error 1|error 2|error 3|error 4|error 5");
if (errorRegex.Match(content).Success)
return "ERROR";
But now I need return which message was in content for example “error 4” Can I do this in one match? What is the best way (optimized for performance) to do this?
Try this by keep a temporary variable of type
Match: