JS Regex找到几个标签的href [英] JS Regex to find href of several a tags
本文介绍了JS Regex找到几个标签的href的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个正则表达式来从这些标签中找到href的内容:
I need a regex to find the contents of the hrefs from these a tags :
<p class="bc_shirt_delete">
<a href="/CustomContentProcess.aspx?CCID=13524&OID=3936923&A=Delete" onclick="javascript:return confirm('Are You sure you want to delete this item?')">delete</a>
</p>
只是网址,而不是href /标签。
Just the urls, not the href/ tags.
我在这里解析纯文本ajax请求,所以我需要一个正则表达式。
I'm parsing a plain text ajax request here, so I need a regex.
推荐答案
你可以尝试这个正则表达式:
You can try this regex:
/href="([^\'\"]+)/g
更新:或更容易通过非贪婪方法:
Update: or easier via non greedy method:
/href="(.*?)"/g
这篇关于JS Regex找到几个标签的href的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文