c# replace with regex code example
Example 1: c# regex replace
Regex.Replace(
"input string", @"[a-zA-Z]+", "replace string"
);
Example 2: regex replace /
// replaces all / in a String with _
str = str.replace(/\//g,'_');
Example 3: c# replace regex string
string pattern = @"\bwest\b";
string modifiedString = Regex.Replace(input, pattern, strReplacement, RegexOptions.IgnoreCase);