class Program
{
static void Main()
{
string input = "hello WoRlD";
string result =
Regex.Replace(input, "world", "csharp", RegexOptions.IgnoreCase);
Console.WriteLine(result); // prints "hello csharp"
}
}
/// 11/11/2022 Mahesh Kumar Yadav. <br/>
/// <summary>
/// No case sensitive in string replace
/// </summary>
/// <param name="originalString"></param>
/// <param name="oldValue"></param>
/// <param name="newValue"></param>
/// <returns></returns>
static string CaseInsenstiveReplace(string originalString, string oldValue, string newValue)
{
Regex regEx = new Regex(oldValue,
RegexOptions.IgnoreCase | RegexOptions.Multiline);
return regEx.Replace(originalString, newValue);
}