I have string like below:
<a href="test1.com">test1</a><a href="test2.com">test2</a>
And my regex is like below:
<a href=(.*?)test2.com(.*?)<\/a>
and my php code:
preg_match('/<a href=(.*?)test2.com(.*?)<\/a>/s',$game,$mat);
So I want to match this whole thing <a href="test2.com">test2</a>
, but instead its matching from the beginning of <a href
and I get following:
<a href="test1.com">test1</a><a href="test2.com">test2</a>
How do I match from test2.com
and match till first left and first right occurances.