0

I'm using notepad++ to do some regex searches throughout my site. What I'm looking to find are empty link tags.

What I want:

<a href="somelink.html"></a>   //Match
<a name="someanchor"></a>   //Not match
<a href="somelink.html"><img src="someimage.jpg"></a>   //Not match

What I tried to search with regex:

<a(.*?)href=(.*?)\"><\/a>

I thought "?" made the search ungreedy, but my search picks up img tags as well.

Rywek
  • 143
  • 10

1 Answers1

2
<a(.*?)href=(((?!img).)*?)\"><\/a>

Try this.See demo.

http://regex101.com/r/nA6hN9/33

vks
  • 67,027
  • 10
  • 91
  • 124