Re: Using eregi_replace()

From: Date: Fri, 01 Aug 2003 15:30:24 +0000
Subject: Re: Using eregi_replace()
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-157963@lists.php.net to get a copy of this message
On Fri, Aug 01, 2003 at 11:25:07AM -0400, Anthony Ritter wrote: > Messju Mohr" <messju@lammfellpuschen.de writes: > > > you mean > > $newtext= ereg_replace(".*?(hello.*going).*","\\1",$text); > > ?? > .................................. > > Thank you but I get: > > Warning: REG_BADRPT: in c:\apache\htdocs\string.php on line 3 grr, of course. ereg doesn't know .*?. you will have to use .*, but this will match the most right "hello" not the most left one. as i said: use preg_replace. > Using: > ..................... > > <? > $text="blah blah blah hello I must be going blah blah"; > $newtext= eregi_replace(".*?(hello.*going).*","\\1",$text); > echo $newtext; > ?> > ................ > > Regards, > TR > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#157963) next »