首页 > 编程技术 > csharp

RegexOptions.IgnoreCase正则表达式替换,忽略大小写

发布时间:2020-6-25 11:42

////////////////////////////
           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);
///////////////

         对于小文本不使用 RegexOptions.Compiled;

标签:[!--infotagslink--]

您可能感兴趣的文章: