I want to extract from a string containing html content, text between the first occurrence of (<a> and <span> tags).
My pattern is as following :
$pattern='/<a[^(span)][\/\(\)-:@!%*>#=_|?$&";.\w\s]+<\/a> <span/um';
I get the output as text between 1st occurrence of <a and last occurrence of <span and not text between 1st occurrence of both.
eg, html content:
<a href="#">asdasdasd</a> <span blah blah></span> blah blah <a>blah </a> <span>blah
Want:
<a href="#">asdasdasd</a> <span
Getting:
<a href="#">asdasdasd</a> <span blah blah></span> blah blah <a>blah </a> <span
'/<a[^(span)][\/\(\)-:@!%*>#=_|?$&";.\w\s]+?<\/a> <span/um';