C# Regex replace url
- by Martijn
I have a bunch of links in a document which has to be replaced by a javascript call. All the links looks the same:
<a href="http://domain/ViewDocument.aspx?id=3D1&doc=form" target="_blank">Document naam 1</a>
<a href="http://domain/ViewDocument.aspx?id=3D2&doc=form" target="_blank">Document naam 2</a>
<a href="http://domain/ViewDocument.aspx?id=3D3&doc=form" target="_blank">Document naam 3</a>
Now I want all this links to be replaced to:
<a href="javascript:loadDocument('1','form')">Document naam 1</a>
<a href="javascript:loadDocument('2','form')">Document naam 2</a>
<a href="javascript:loadDocument('3','form')">Document naam 3</a>
So the Id=3D in the url is the first parameter in the function and the doc parameter is the second parameter in the function call.
I want to do this using Regex because I think this is the quickest way. But the problem is my regex knowledge is too limited