Re: eregi_replace help needed

From: Date: Thu, 29 Jan 2004 18:55:25 +0000
Subject: Re: eregi_replace help needed
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-176248@lists.php.net to get a copy of this message
Hi Nico, On 29 Jan 2004 at 17:52, php4@nv.jakaranda.co.za wrote: > I want to locate patterns such as > > 12345678 > 1 23 45 67 89 > 1 2 34 567 890 > > and replace the pattern string with a new string. > > I tried > > $filter['message'] = eregi_replace("[0-9\s]{4,}",'<string > replaced>', $filter['message']); Use preg_replace() with the "i" pattern modifier instead of eregi_replace(), e.g. preg_replace('/[\d\s]{4,}/i', '<string replaced>', $string) Works like a charm. Cheers, Erik

« previous php.general (#176248) next »