M
maziar.aflatoun
Hi,
My knowledge of RE is really rusty now. Can someone please help me out
with this problem,
I make a request to our other server that's running php and I grab the
content of the directory in html format. Next I
want to search for all the instances of SRC="???"
<IMG SRC="/icons/back.gif" ALT="[DIR]"> <A HREF="/updates/">Parent
Directory</A> 06-Apr-2009 01:06 -
<IMG SRC="/icons/dir.gif" ALT="[DIR]"> <A HREF="ad/">ad/</
A> 06-Apr-2009 01:12 -
<IMG SRC="/icons/dir.gif" ALT="[DIR]"> <A HREF="beta/">beta/</
A> 10-Mar-2009 20:47 -
<IMG SRC="/icons/unknown.gif" ALT="[ ]"> <A
HREF="something">something..></A> 10-Apr-2008 00:13 94.9M
and replace it with http://www.ourdomain.com/??? so SRC="/icons/
back.gif" would become SRC="http://www.ourdomain.com/icons/back.gif".
I need this for even known image names in the future.
I have this so far
string regex = "src=\"([^\"]+)"; // which pulls out /icons/image.gif
page
Regex r = new Regex(regex, RegexOptions.IgnoreCase);
return r.Replace(html, "$1").Replace(?????????) // now how to do I
apply the prefix part?
Can you please help me out or show me more simple way?
Thanks
M.
My knowledge of RE is really rusty now. Can someone please help me out
with this problem,
I make a request to our other server that's running php and I grab the
content of the directory in html format. Next I
want to search for all the instances of SRC="???"
<IMG SRC="/icons/back.gif" ALT="[DIR]"> <A HREF="/updates/">Parent
Directory</A> 06-Apr-2009 01:06 -
<IMG SRC="/icons/dir.gif" ALT="[DIR]"> <A HREF="ad/">ad/</
A> 06-Apr-2009 01:12 -
<IMG SRC="/icons/dir.gif" ALT="[DIR]"> <A HREF="beta/">beta/</
A> 10-Mar-2009 20:47 -
<IMG SRC="/icons/unknown.gif" ALT="[ ]"> <A
HREF="something">something..></A> 10-Apr-2008 00:13 94.9M
and replace it with http://www.ourdomain.com/??? so SRC="/icons/
back.gif" would become SRC="http://www.ourdomain.com/icons/back.gif".
I need this for even known image names in the future.
I have this so far
string regex = "src=\"([^\"]+)"; // which pulls out /icons/image.gif
page
Regex r = new Regex(regex, RegexOptions.IgnoreCase);
return r.Replace(html, "$1").Replace(?????????) // now how to do I
apply the prefix part?
Can you please help me out or show me more simple way?
Thanks
M.