Re: [PHP4BETA] preg_replace Q
| From: | Cynic | Date: | Thu, 20 Apr 2000 19:44:08 +0000 |
| Subject: | Re: [PHP4BETA] preg_replace Q | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-13832@lists.php.net to get a copy of this message | ||
At 14:01 20.4.2000 -0500, Andrei Zmievski wrote the following:
--------------------------------------------------------------
>That is a generic PCRE library manual. It was not written with PHP in
>mind and since it talks only about PCRE syntax, it mentions only that
>you need to escape $ with a backslash if you want to use it literally.
------end of quote------
Ok, so provided I don't use any variables in the pattern I can enclose
the pattern in apostrophes, and thus use only \$. Gooooooooooood.
I will bear this in my mind.
From the manual:
The use of subpatterns for more complicated assertions is described below.
The backslashed assertions are
\b word boundary
\B not a word boundary
Excuse me if I'm wrong, but isn't this a bug? Or is my English so poor?
I would think that \b\$ means '$ when it's the first or the last character
in a word'.
Furthermore, if the manual is completely wrong and the current state of
this assertion is correct, there seems to be a great inconsistency. Again,
from the manual:
\d any decimal digit
\D any character that is not a decimal digit
\s any whitespace character
\S any character that is not a whitespace character
\w any "word" character
\W any "non-word" character
lowercase letter are 'positive', while uppercase ones are 'negative'. Seems
like \b & \B have it other way around.
____________________________________________________________
Cynic:
A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.
cynic@mail.cz
ICQ: 2808 2505