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.