Could someone help me out with a strange regular expression I'm trying to write.
I'm trying to scan through a HTML page, and convert image tags into links. The problem is that the page maybe scanned more than once, so I don't want to convert image tags that have been already done in a previous run.
So I reckon that I want match an image tag, but only if it IS NOT enclosed by a
tag.
should match, but
Should not match
Any ideas how I go about this?
I'm trying to scan through a HTML page, and convert image tags into links. The problem is that the page maybe scanned more than once, so I don't want to convert image tags that have been already done in a previous run.
So I reckon that I want match an image tag, but only if it IS NOT enclosed by a
Code:
<a href/>
Code:
<img src="my.jpg"/>
should match, but
Code:
<a href="xxxxx"><img src="my.jpg"/></a>
Should not match
Any ideas how I go about this?