note 18877 deleted from function.ereg-replace by kennyt

From: Date: Wed, 26 Jan 2005 03:57:04 +0000
Subject: note 18877 deleted from function.ereg-replace by kennyt
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-83997@lists.php.net to get a copy of this message
Note Submitter: roland at inkoeln dot com ---- ereg_replace can't do minimal matching (+? and *?). Example: $txt = 'a=b=c'; $a = ereg_replace('.+(=.+)', 'x\1', $txt); $b = preg_replace('/.+?(=.+)/', 'x$1', $txt); print "$a, $b"; the result is: x=c, x=b=c because of the more powerful perl compatible regexp-syntax you should always prefer preg_replace (and preg_match).

« previous php.notes (#83997) next »