I have the following expression: [^(\r\n)]* to recognize any text that doesn’t contain \r\n.
However when the text contains ( or ) it is not recognized.
Examples:
"I have following expression to recognize any text."will be recognized OK."I have following expression (A) to recognize any text."will NOT be recognized.
I’d like as a result the complete text: "I have following expression (A) to recognize any text."
Use
Regex.Escapeto process the input before running the regular expression. This method is specifically intended to “defang” any characters with special meaning in regular expressions so that the input is always turned into something that matches a literal string.