Click to See Complete Forum and Search --> : can you help me with a regexp jeff please
Scriptage
08-18-2003, 07:55 PM
I've never been great with regular expressions.
Could you please tell me how to go about doing a regexp to do the followng:
Change:
<img src='hi.jpg'>
to:
<img src='blahblah/hi.jpg'>
this would also need to allow for many img tags on the same line.
Thanks in advance.
Carl
Jeff Mott
08-18-2003, 08:22 PM
Technically it can be as simple ass|<img src='hi\.jpg'>|<img src='blahblah/hi.jpg'>|g;But this is only if this is a job you need for yourself. If this needs to also work correctly with all variations of valid HTML then that will take more work. So you'll have to let me know if that is indeed what you need before I get into it.
Scriptage
08-18-2003, 08:25 PM
cheers for the reply jeff.
I do need it to work with all valid HTML.
I've been using:
$string=join("src='fileManager.pl?view=", split("src='", $string));
$string=join('src="fileManager.pl?view=', split('src="', $string));
but i need a way to change the values in 'dodgy html' ie,
<img src=blah.gif>
I need this to become:
<img src=fileManager.pl?view=blah.gif>
Cheers