I am trying to get a match on a tags which have some text preceding it few samples :
<p> some text here <a href="#">and here</a></p> <!--want match--><br/>
<p> some text here and number 55 <a href="#">and here</a> </p> <!--want match--><br/>
<p> <a href="#">and here</a></p> <!--do not want match--><br/>
Now when I use this regex
>[\w,.-_|]+<a (.*?)</a>\s*<
I do not get a match on any of these. However, this regex
>[\s\w,.-_|]+<a (.*?)<\/a>\s*<
gives match on all 3, where I want only first 2 as match
The problem here is "\s" whitespace. I dont mind whitespace between text, but if there is only whitespace and no text, there should be no match.
How can I do that?