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

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

Reply via email to