如何提取href值

I would like to extract the href value (without any library), how can I do it?

<dm:link rel="uql" href="URL-URL-URL-URL" type="application/rss+xml"/>

Thanks.

Though arguably a DOM parser would be the best solution, this small task could be done quite reliably with a regex.

Also, you'd need to import the info for the dm namespace if using a library.

preg_match('/\shref="(?<href>[^"]+)"/', $str, $match);

You're usually better off parsing it using the likes of simplexml or dom libraries. Using a regex for this is bug-prone.

try this

(?<=href\=\")[\w:\-\=\/\:\d\?\.\#]*

should work

enter image description here