Re: preg_match_all but no preg_replace_all?

From: Date: Tue, 10 Aug 2004 16:53:59 +0000
Subject: Re: preg_match_all but no preg_replace_all?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-193322@lists.php.net to get a copy of this message
* Marten Lehmann <lehmann@cnm.de>: > I want to be sure, that preg_replace replaces all matches. But it > doesn't accept the /g modifier. And anyhow, there's no preg_replace_all > like there is an preg_match_all. Will preg_replace replace everything by > default? Yes. preg_replace is greedy by default. If you *don't* want it to replace everything, you need to pass a fourth argument, which tells it the number of replacements to make. See the docs for preg_replace for more details. -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association | http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:matthew@garden.org | http://vermontbotanical.org

« previous php.general (#193322) next »