当前位置:主页 > 软件编程 > .NET代码 >

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

时间:2021-06-10 08:22:53 | 栏目:.NET代码 | 点击:

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

您可能感兴趣的文章:

相关文章