需要定期EX pression删除< A HREF =" XX">名称和LT; / A>从字符串变量 [英] Need regular expression to remove <a href="xx">Name</a> tags from a string

查看:98
本文介绍了需要定期EX pression删除< A HREF =" XX">名称和LT; / A>从字符串变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要定期EX pression从以下网址删除标记< A HREF =htt​​p://example.com>名称< / A> 只输出字符串名称。我使用C#.net。

Need regular expression to remove the a tag from the following url <a href="http://example.com">Name</a> to output only the string "Name". I am using C#.net.

任何帮助是pciated AP $ P $

Any help is appreciated

推荐答案

这会是一个pretty好工作:

This will do a pretty good job:

str = Regex.Replace(str, @"<a\b[^>]+>([^<]*(?:(?!</a)<[^<]*)*)</a>", "$1");

这篇关于需要定期EX pression删除&LT; A HREF =&QUOT; XX&QUOT;&GT;名称和LT; / A&GT;从字符串变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆