正则表达式得到href ="#" [英] Regex to get href="#"

查看:213
本文介绍了正则表达式得到href ="#"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我有一个href,例如< a href ='http://www.google.com'> google< / a> ;,我需要将其剥离以使其无法点击,因此我希望将其替换为< ; a href ='#'> google< / a>。

I have an href, for example <a href='http://www.google.com'>google</a>, and I need to strip it off to make it unclickable, so I wish for it to be replaced by <a href='#'>google</a>.

您能否建议我使用RegEx模式来实现此目标,因为我对RegEx不太满意。

Can you suggest me a RegEx pattern to achieve this, since I am not very good with RegEx's.

谢谢

问候

Johann

推荐答案

以下正则表达式将匹配替换的部分:"< a href = \'[/:\w& \?= \。] + \'>"

HEre是如何实现这个的一个例子



The following regex will match the part that nees replacing: "<a href=\'[/:\w&\?=\.]+\'>"

HEre is an example of how to implement this




代码段


这篇关于正则表达式得到href =&quot;#&quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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