I'm looking for a regular expression to find a tag if used as a self-closing tag. However, I want to ignore any self-closing tags that might be embedded in the innerHtml; if not used in a self-closing way.
Here's an example of the tag used in a self-closing way:
This is a test <a id="anchor1" />.
Here's an example of the tag when not used in a self-closing way, which I want to include:
This is a separate test <a id="anchor2"><img src="file.png"/></a>.
Here's the regular expression I'm trying to use, which is picking up both:
(?i)<a.*[^<]?/>
Any suggestions about why this isn't working?