请教正则表达式代码,将<a href="xxx">yyy</a>中的yyy部分取出来 试试吧不知道正不正确:\<a.+?href=['""](?!http\:\/\/)(?!mailto\:)(?>foundAnchor>[^'"">]+?)[^>]*?\> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Regex.Replace(str, @"<a[^>]*>(?<content>.*?)</a>","${content}",RegexOptions.IgnoreCase | RegexOptions.Singleline); http://www.regexlib.com/DisplayPatterns.aspx?cattabindex=1&categoryId=2 好象还是不行,我已经改成string test = @"<a href='View.aspx?Id=4'>盐移分司[2004]132号</a>";Regex.Replace(test, @"<a[^>]*>(?<content>)</a>", "${content}");this.Label1.Text = test;这样了,显示出来的还是原来test的值,但Regex.IsMatch(test, @"<a[^>]*>.*</a>")是true,就是Replace那一段老写不对,请指教。 搞定了this.Label1.Text = Regex.Replace(@"<a href='View.aspx?Id=4'>盐移分司[2004]132号</a>", @"^\s*<a[^>]*>\s*(?<content>\S*)\s*</a>\s*$", "${content}");就行了 怎么向ftp中的txt文件写入数据 用JS,还是用服务器端,代码! 请教关于返回值的问题,在线等 為什么我用WebClient或者WebRequest產生的網頁源代碼和查看頁面源代碼所看見的不一樣呢? 还有一个问题,不同工程的会话可以通用吗?比如Session; 在这种情况下,是生成html的好,还是数据绑定的好 asp.net ajax:怎样使用uploadfile控件? javascript确认消息框,如何根据结果继续或者结束? 小妹请教诸位高手…… .net网站制作 怎么判断一个字符串中包含了另一个字符串! Javascript的一个小问题?
string test = @"<a href='View.aspx?Id=4'>盐移分司[2004]132号</a>";
Regex.Replace(test, @"<a[^>]*>(?<content>)</a>", "${content}");
this.Label1.Text = test;
这样了,显示出来的还是原来test的值,但
Regex.IsMatch(test, @"<a[^>]*>.*</a>")是true,就是Replace那一段老写不对,请指教。
this.Label1.Text = Regex.Replace(@"<a href='View.aspx?Id=4'>盐移分司[2004]132号</a>", @"^\s*<a[^>]*>\s*(?<content>\S*)\s*</a>\s*$", "${content}");
就行了