potential preg_replace bug; unsure however
| From: | alvarez at sto13 dot st-oneline dot de | Date: | Sat, 01 Sep 2001 18:55:15 +0000 |
| Subject: | potential preg_replace bug; unsure however | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-65618@lists.php.net to get a copy of this message | ||
I built a Perl-style regex to match function calls in C-like
languages where $name is the functions name. The functions
are assumed to accept a single string as parameter.
Here it is.
/$name\s*\(\s*\"(.*)\"\s*\)\s*;/s
The expression is successfully preg_match'ed on a stream
of code, but when preg_replace is passed the same expression
it does not return. The piece of code I tested this with was
fairly small so that an increased demand of computation time
is unlikely be the reason for this behaviour.
Substituting the subexpression (.*) by ([^\"]*) remedies this.
The version of the PHP install is 4.05.
Any ideas?
D. Alvarez Arribas <alvarez@st-oneline.net>