左右括号‘(’‘)’配对的正则表达式 a=string.indexof("(")b=string.lastindexof(")")string.substring(a-1,b-a) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 icehawk(我是一只小小鸟) 我不是要查询子字符串,我是要写这样的正则表达式 string cutText = "已知的字符串"; System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"\((?<str>[\w\(\)]+)\)+"); System.Text.RegularExpressions.Match match = regex.Match(cutText); if(match.Success) { MessageBox.Show(match.Groups["str"].Value); } 谢谢 showtimenow(景)你的解答还是没有解决我的问题我想正则表达式也不是万能的,他并不能实现动态匹配 看看这样是你的要求吗? string cutText = this.textBox1.Text; System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"\((?<str>.*)\)+"); System.Text.RegularExpressions.Match match = regex.Match(cutText); if(match.Success) { MessageBox.Show(match.Groups["str"].Value); } 把每一个(xxx)取出来,然后地规调用 TO: qianli918(千里马)其实也不是要实现什么,我只是想看看 正则表达式是否有这样的功能 showtimenow(景)匹配出来的有严重问题如:abcd(4348743747))结果是:4348743747)应该是:4348743747 跪求大婶帮忙!!!! 请教如何直接在Winform窗体上输出文字? WPF 获取鼠标全局坐标 C#.net 修改代码之后,程序没有发生变化 急求:C#已知一条线(含三条线段)求平行线代码 发布客户端程序遇到的棘手问题 请问httpWebRequest中的AddRange在ftpWebRequest所对应的方法是什么啊? 100分求一个窗体拖动(跟网上其他介绍的情况有点不同)的方法.顶者有分. 谁能送我一套项目文档,用于动手学习,请帮忙!!! .Net平台开源邮件系统方案 请教 如何设置使csc.exe手动关闭
我不是要查询子字符串,我是要写这样的正则表达式
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"\((?<str>[\w\(\)]+)\)+");
System.Text.RegularExpressions.Match match = regex.Match(cutText);
if(match.Success)
{
MessageBox.Show(match.Groups["str"].Value);
}
string cutText = this.textBox1.Text;
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"\((?<str>.*)\)+");
System.Text.RegularExpressions.Match match = regex.Match(cutText);
if(match.Success)
{
MessageBox.Show(match.Groups["str"].Value);
}
如:abcd(4348743747))
结果是:4348743747)
应该是:4348743747