![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | C# Regular expression to find all instance and add a prefix 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 System Specs![]() |
| | #2 (permalink) |
| | Re: C# Regular expression to find all instance and add a prefix Hello maziar.aflatoun@xxxxxx, Answered in another newsgroup. Quote: > 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>> Quote: > <IMG SRC="/icons/dir.gif" ALT="[DIR]"> <A HREF="beta/">beta/</ > A>> Quote: > <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. Jesse Houwing jesse.houwing at sogeti.nl |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Regular Expression help C# | .NET General | |||
| Regular Expression for ../ | .NET General | |||
| Help with a regular expression | VB Script | |||
| regular expression help | VB Script | |||
| Regular expression notes | PowerShell | |||