C#正则表达式去除中括号[]和小括号{}及其中内容
1 | string pattern = "[aa][bb][cc][dd][ee]{jsons.cn}Jsons.cn工具站点" ; |
2 | pattern = Regex.Replace(pattern, @"\[.*\]" , "" ); //过滤[] |
3 | pattern = Regex.Replace(pattern, @"\{.*\}" , "" ); //过滤{} |
4 | Response.Write(pattern); |
5 | //输出:Jsons.cn工具站点 |
原文链接:C#正则表达式去除中括号[]和小括号{}及其中内容