I need to find the most optimal solution using Regex to find URL's inside a block of HTML and add a new attribute Name="true" inside the tag.
Below is an example of HTML (which can contain embedded JS), I just need to add the new attribute Name="true" to any URL and NOT effect any embedded JS file.
Example HTML :
<HTML>
<a href="abc.aspx">
<a href="abc.aspx">
<a href="abc.aspx">
<script type="javascript">
function{
if("somefile.aspx")
{
do something...
}
}
</script>
</HTML>
Expected HTML :
<HTML>
<a href="abc.aspx" Name="true">
<a href="abc.aspx" Name="true">
<a href="abc.aspx" Name="true">
<script type="javascript">
function{
if("somefile.aspx")
{
do something...
}
}
</script>
</HTML>