So I have this regex:
&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)
That matches all &'s in a block of text
However, if I have this string:
& & & & & <a href="http://localhost/MyFile.aspx?mything=2&this=4">My Text &</a>
---------------------------------------------------------^
... the marked & also get's targeted - and as I'm using it to replace the &'s with & the url then becomes invalid:
http://localhost/MyFile.aspx?mything=2&amp;this=4
D'oh! Does anyone know of a better way of encoding &'s that are not in a url.