Nadeem
Nadeem

Reputation: 145

Javascript regex to get the href attribute data from a text

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

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"

Upvotes: 2

Views: 228

Answers (1)

Nadeem
Nadeem

Reputation: 145

Solution : $(data).find('._2s25 ._606w').attr('href');.

Reference:- Parsing returned HTML from jQuery AJAX request

Upvotes: 2

Related Questions