Re: [PHP4BETA] perl compatible regex search&replace behaving oddly... bug?
| From: | Andrei Zmievski | Date: | Tue, 18 Jan 2000 22:12:08 +0000 |
| Subject: | Re: [PHP4BETA] perl compatible regex search&replace behaving oddly... bug? | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-9268@lists.php.net to get a copy of this message | ||
On Tue, 18 Jan 2000, Alexander Fordyce wrote:
> yikes... Well, I guess I'll have to -- I'll try disabling everything
> I don't absolutely need right now. Can you suggest a possible source
> of conflict? As I mentioned, it configured and compiled with the
> full bag of tricks completely without incident, and I haven't had any
> other problems with the machine.
In phpinfo() check which version of PCRE you have.
Try running these tests:
$a="abc";
echo preg_replace("/.*/","X",$a);
Here are the results, replacing the regex argument each time:
regex expected
/.*/ XX
/.+/ X
// XaXbXcX
/\w/ XXX
/^\w+$/ X
/\b/ XabcX
/^\w*?/ XXbc
/^\w+?/ Xbc
-Andrei
Computer, if you don't open that exit hatch this moment I shall zap straight
off to your major data banks and reprogram you with a very large axe.
-- Douglas Adams / The Hitchhiker's Guide to the Galaxy