软件编程
位置:首页>> 软件编程>> C#编程>> RegexOptions.IgnoreCase正则表达式替换,忽略大小写

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

  发布时间:2022-05-03 17:25:45 

标签:正则表达式,大小写

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

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com