Code: Select all
/<a.+href=["|\'](.[^"|\']+)/iHow do I match multiple <a href> when they reside on a single line? Why is only the last one being matched?
p.s-I'm using preg_match_all with default arguments
Cheers
Moderator: General Moderators
Code: Select all
/<a.+href=["|\'](.[^"|\']+)/iCode: Select all
/<a(.+?)href=["|']([^"|']+?)/i
Code: Select all
'/<a.+href=["|\'](.[^"|\']+)["|\']?/i'Code: Select all
<a href="index.html">Test 1</a> <a href="about_ut.htm">Test 2</a>Code: Select all
<a href="index.html">Test 1</a><a href="about_ut.htm">Test 2</a> Code: Select all
/<a\s+[^>]*?\bhref=(["'])(.*?)\\1/i