At 11:27 19-12-02 +0000, John Wards wrote:
On Thursday 19 Dec 2002 11:25 am, Wico de Leeuw wrote:
Preg_Replace('~src="(?!http://)~iS', 'src="http://www.domain.com/', $string);

1. find src="
2. look forward if next chars are http://
i=not case sensitive
S=optimize pattern because we going to use is many times

You should add also a check if it starts with <img and check for single qoutes
like this:

Preg_Replace('~(<img\s+(.*?)(?!\s)src=["']?)(?!http://)~iS', '\1http://www.domain.com/', $string);


Gr,


Ha! Ta........

I am all for quick fixes but I am new to RegExpresions...so could someone
explain what its all doing for me.....

Cheers
John

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to