Re: [PHP4BETA] help with ereg
| From: | Stanislav Malyshev | Date: | Wed, 22 Mar 2000 09:23:09 +0000 |
| Subject: | Re: [PHP4BETA] help with ereg | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-12483@lists.php.net to get a copy of this message | ||
VT>> eregi("{(.+)}","Test string {one} and test line {two}",$regs)
VT>> return $regs[1]="one} and test line {two".
That's because + is "greedy". You need to use "{([^}]+)}" or use
preg_match in non-greedy mode (or with non-greedy "+?" instead of "+").
--
Stanislav Malyshev stas@zend.com
+972-3-6139665