Re: preg_match_all but no preg_replace_all?

From: Date: Tue, 10 Aug 2004 17:31:11 +0000
Subject: Re: preg_match_all but no preg_replace_all?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-193333@lists.php.net to get a copy of this message
On 10 Aug 2004 16:53:59 -0000, in php.general you wrote: >Yes. preg_replace is greedy by default. Err, global, that is (although it's also greedy per default, but then again, that's also the case for ereg-functions and perl) "greedy" is the term of whether or not a range of matches should be expanded to as long as possible, e.g.: pattern: /<.*>/ string: one <foo> two <bar> three .. wil match "<foo> two <bar>" and not just "<foo>". .*? on the other hand (or the U pattern modifier) makes the capture ungreedy. ... just trying to clear up a common mix-up in terms :) -- - Peter Brodersen

« previous php.general (#193333) next »