Re: RegExpres Prob

From: Date: Thu, 19 Dec 2002 13:01:57 +0000
Subject: Re: RegExpres Prob
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-128849@lists.php.net to get a copy of this message
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


« previous php.general (#128849) next »