Aloha,
I need to match page.aspx?cmd=Show&id=
but not match http://random address/page.aspx?cmd=Show&id=
Right now I'm just doing a simple resting replace with strContent.Replace("page.aspx?cmd=Show&id=", "page.aspx/Show/");
but to avoid the above i think I need to move to regular expressions.
Edit: Sorry i was a little short on details The current replace works because I was not taking into account that the address being modified should only be relative addresses, not absolute. I need to catch all relative addresses that match page.aspx?cmd=Show&id=
and convert that string into page.aspx/Show/
.
The .StartsWith
and ^
wont work because I an looking in a string that is a full html page. So I need to be able to convert:
<p>Hello, please click <a href="page.aspx?cmd=Show&id=10">here</a>.</p>
into
<p>Hello, please click <a href="page/Show/10">here</a>.</p>
but not convert
<p>Hello, please click <a href="http://some address/page.aspx?cmd=Show&id=10">here</a>.</p>
I used an A tag for my example but I need to convert IMG tags as well.
Thanks!