Javascript正则表达式从文本中获取href属性数据 [英] Javascript regex to get the href attribute data from a text
问题描述
我一直在使用ajax,并且已经检索了一些数据,我想从href属性中提取具有特定类名的url.我需要一个javascript正则表达式来从那堆数据中提取URL.该数据中的网址应如下所示.
I have been working with ajax and I have retrieved some data, I want to extract a url from an href attribute, with specific class name. I need a javascript regex for it to extract me the url from that bunch of data. The URL from that data should look like this.
https://www.facebook.com/username
https://www.facebook.com/username
图片链接,此图片显示了数据以及其特定的类名和href中的网址,我想通过该特定的类名来提取该网址.类名称为: class ="_ 2s25 _606w"
Image Link, this image shows the data, and its specific class name and the url in the href, I want to extract that url, fro, through that specific class name. The class name is : class="_2s25 _606w"
推荐答案
解决方案:$(data).find('._2s25 ._606w').attr('href');.
这篇关于Javascript正则表达式从文本中获取href属性数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!