I am new to regular expression. I am trying to match a group of characters using regular expression, but it does not work.
Here is my code.
string test = "Hello$@%$all";
string regex = "($@%$)";
string result = Regex.Replace(test, regex, "\n");
Any help??
You need to escape the characters that has special meaning in regular expressions.
Characters like
$has special meaning when used in a regular expression. So tell apart whether it’s a character used to signify something in the expression or whether you need to literally match that character, you can escape it using a\