RegexOptions.IgnoreCase regular expression substitution ignoring case

  • 2020-05-09 19:13:00
  • OfStack

////////////////////////////
                    string inputstr = "@{AbcD},@{bbbb},@{ABcd}";
                      string pmType = "@";
                      string regTxt = (pmType + "\\s*\\{\\s*" + "abcd" + "\\s*\\}").Replace("(", "\\(").Replace(")", "\\)");
                      //string regTxt = (pmType + "\\s*\\{\\s*" + "aaaa" + "\\s*\\}").Replace("(", "\\(").Replace(")", "\\)");
                    // string regTxt = @"@\s*\{\s*aaaa\s*\}";
                    // string regTxt = @"@\s*\{\s*aaaa\s*\}/gi";
                      inputstr = Regex.Replace(inputstr, regTxt, "CCC", RegexOptions.IgnoreCase | RegexOptions.Compiled);
///////////////

              does not use RegexOptions Compiled for small text;


Related articles: