On Fri, Aug 01, 2003 at 11:25:07AM -0400, Anthony Ritter wrote:
> Messju Mohr" <[EMAIL PROTECTED] 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

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

Reply via email to