preg_replace help

From: Date: Fri, 19 Dec 2003 17:19:00 +0000
Subject: preg_replace help
Groups: php.general 
Request: Send a blank email to php-general+get-173029@lists.php.net to get a copy of this message
I am trying to build a pattern to do the following: - Find all occurences of HREF=" and SRC=" except those that include the HTTP:// in their path - Insert my own domain string (e.g.: http://www.my_domain.com) So has an example the input string would be : $val = ' <A href="http://www.my_domain.com/test.php">my_domain</A> <A href="hello.com">hello</A> <IMG src="images/test.jpg"> <IMG src="http://www.my_domain.com/images/tstimg.jpg> '; And I would like to end up with: $val = ' <A href="http://www.my_domain.com/test.php">my_domain</A> <A href="http://www.my_domain.com/hello.com">hello</A> <IMG src="http://www.my_domain.com/images/test.jpg"> <IMG src="http://www.my_domain.com/images/tstimg.jpg> '; Thank you in advance.

« previous php.general (#173029) next »