javascript - 获取与 javascript 正则表达式的链接

标签 javascript jquery regex

如何使用 javascript 正则表达式获取第一个函数参数?例如,我在页面中有这个元素,我想在点击标签时检索内联链接。 示例:

<li><a href="#blog" data-rel="close" onclick="getRSSFeed('http://moi.ir/Portal/RssPage/ShowRss.aspx?CategoryID=541ac873-3706-4f31-97e7-5cd6d51170eb','BlogList');">news</a></li>

我想要这段文字:http://moi.ir/Portal/RssPage/ShowRss.aspx?CategoryID=541ac873-3706-4f31-97e7-5cd6d51170eb

最佳答案

onclick[^(]*\('([^']+)

试试这个。抓取组 1。查看演示。

http://regex101.com/r/yR3mM3/54

关于javascript - 获取与 javascript 正则表达式的链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27297625/

相关文章:

java - 运行Rhino时出错

javascript - 具有不同宽度的两列 Masonry jQuery?

javascript - 使用 jQuery 在 TextArea 中显示 xml

java - 删除 Java 字符串中给定模式的表行

python - 如何使用 sed -n 但在 Python 中从文本文件中提取一系列行?

javascript - React JS 和 sublime text 不兼容

javascript - 将 dat.GUI 下拉菜单字符串映射到值

jquery - Elevate Zoom 插件中的缩放图像完全相同

javascript - Django urlpatterns 正则表达式不精确,得到 404?

javascript - 不要包含使用 node-tar 进行存档的绝对路径