Sep 16, 2014

Case insensitive Regex Relpace

Case insensitive Regex Relpace:
string source = "Hello India";
string expr = @"\b" + Regex.Escape("Hello") + @"\b";
source = Regex.Replace(source, expr, m =>
{
    return "World";
}, RegexOptions.IgnoreCase);
Console.WriteLine(source);
Replaces the word "Hello"|"hello"|"hELLO" with the word "World"