How can I match both (http://[^"]+)‘s?:
<a href="http://yoursite.com/goto/http://aredirectURL.com/extraqueries"></a>
(I know it’s an illegal URL, but same idea)
I want the regex to give me these two matches:
1 http://yoursite.com/goto/http://aredirectURL.com/extraqueries
2 http://aredirectURL.com/extraqueries
Without running multiple preg_match_all’s
Really stumped, thanks for any light you can shed.
This regular expression will get you the output you want:
((?:http://[^"]+)(http://[^"]+)). Note the usage of the non-capturing group(?:regex). To read more about non-capturing groups, see Regular Expression Advanced Syntax Reference.The above code outputs the following: