Re: Using eregi_replace()
| From: | Marek Kilimajer | Date: | Fri, 01 Aug 2003 15:13:05 +0000 |
| Subject: | Re: Using eregi_replace() | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157954@lists.php.net to get a copy of this message | ||
And besides ereg_replace would not work becase it's greedy, .* would match "going", than "going" would not be found and the whole match would fail.
messju mohr wrote:
you mean $newtext= ereg_replace(".*?(hello.*going).*","\\1",$text); ?? i would suggest preg_replace in favour to ereg_replace: $newtext= preg_replace("!.*?(hello.*going).*!","$1",$text); it is more powerfull, faster and widely available. greetings messjuecho $newtext; ?> ........... Thank you. Tony Ritter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php