Quantcast
Channel: Grabbing the href attribute of an A element - Stack Overflow
Viewing all articles
Browse latest Browse all 11

Grabbing the href attribute of an A element

$
0
0

Trying to find the links on a page.

my regex is:

/<a\s[^>]*href=(\"\'??)([^\"\'>]*?)[^>]*>(.*)<\/a>/

but seems to fail at

<a title="this" href="that">what?</a>

How would I change my regex to deal with href not placed first in the a tag?


Viewing all articles
Browse latest Browse all 11

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>