I have hundreds of links on a website that were manually programmed in HTML as hyperlinks. Our designer informed me that they shouldn't be links, so rather than line by line remove the <A> element from my code I'm looking to use the Regular Expression search and replace function within my development IDE to resolve this issue for me.
Here is some example HTML code I have...
<dd><a href="/Residential-Mortgages/First-Time-Buyers.php">First Time Buyers</a></dd>
<dd><a href="/Residential-Mortgages/Holiday-Homes.php">Holiday Homes</a></dd>
<dd><a href="/Residential-Mortgages/Second-Homes.php">Second Homes</a></dd>
<dd><a href="/Residential-Mortgages/Shared-Equity.php">Shared Equity</a></dd>
<dd><a href="/Residential-Mortgages/Government-Schemes.php">Government Schemes</a></dd>
<dd><a href="/Residential-Mortgages/Secured-Loans.php">Secured Loans</a></dd>
<dd><a href="/Residential-Mortgages/Large-Loans.php">Large Loans</a></dd>
<p><a href="http://www.google.com/" rel="external">my link</a></p>
The problem I'm having is that I want to remove all the <A> elements from the page except for any that have the "rel" attribute set.
So for example match all the <A> elements inside the <DL> element but not the <A> element within the <P> element at the bottom.
I've been using http://gskinner.com/RegExr/ to help me test my RegEx and so far I have the following...
<a href=".+"(?! rel="external")>.+</a>
...but it doesn't work as I expected (i.e. it still matches every <A> element on the page), so I need a little guidance please.