RegexOptions.IgnoreCase正则表达式替换,忽略大小写
发布时间:2016-12-28 来源:查字典编辑
摘要:////////////////////////////stringinputstr="@{AbcD},@{bbbb},@{ABcd}";s...
////////////////////////////
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*aaaas*}";
// string regTxt = @"@s*{s*aaaas*}/gi";
inputstr = Regex.Replace(inputstr, regTxt, "CCC", RegexOptions.IgnoreCase | RegexOptions.Compiled);
///////////////
对于小文本不使用 RegexOptions.Compiled;