I need to parse a string using php preg_replace. I need it to find instances of src=" then change it to src="http://www.mysite.ie/ but only if it's not already src="http://www.mysite.ie/
so it would change the following
to
Does anyone know how to do this? I hate regular expresions.
Edit: Ok I'm getting somewhere now using the pattern below, this might do the trick..
so it would change the following
Code:
<img src="http://www.irishwebmasterforum.com/images/0.png">
<img src="http://www.mysite.ie/images/0.png">
<img src="http://www.irishwebmasterforum.com/images/0.png">
Code:
<img src="http://www.mysite.ie/images/0.png">
<img src="http://www.mysite.ie/images/0.png">
<img src="http://www.mysite.ie/images/0.png">
Edit: Ok I'm getting somewhere now using the pattern below, this might do the trick..
Code:
(?!src="http)src="