Re: RegExpres Prob

From: Date: Thu, 19 Dec 2002 11:25:03 +0000
Subject: Re: RegExpres Prob
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-128844@lists.php.net to get a copy of this message
At 11:18 19-12-02 +0000, John Wards wrote:
I have a regexp problem I want to go through some HTML and where <img src="path/to/image.jpg"> I want to change it to this <img src="http://www.domain.com/path/to/image.jpg"> BUT if the image tag is like this <img src="http://www.domain.com/path/to/image.jpg"> already I don't want anything to happen........ I thought this would do it: ereg_replace("src=\"(^http)","src=\"http://www.domain.com/", $string);
Preg_Replace('~src="(?!http://)~iS', 'src="http://www.domain.com/', $string);
but it didn't............... Argh... Cheers John Wards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#128844) next »