Bug #11461 Updated: \. after \- does not work
| From: | rasmus@php.net | Date: | Wed, 15 May 2002 12:36:16 +0000 |
| Subject: | Bug #11461 Updated: \. after \- does not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-7747@lists.php.net to get a copy of this message | ||
ID: 11461
Updated by: rasmus@php.net
Reported By: aweber@multamedio.de
Status: Bogus
Bug Type: Regexps related
Operating System: Linux 2.2.16-SMP
PHP Version: 4.0.6RC3
New Comment:
PHP does support ARE and again, this is not the issue here.
Previous Comments:
------------------------------------------------------------------------
[2002-05-15 07:50:41] webmaster@linuxconfig.de
Maybe you shoud include both types and let the user decide with of them
he wants to use.
------------------------------------------------------------------------
[2002-05-15 07:49:15] alxwe@t-online.de
It depends whether you use the Extended Regular Expressions (as PHP
does at the moment) or the Advanced Regular Expressions which have much
more features. Both are defined by POSIX.
Using ARE constructs like [0-9A-Za-z_\-\.] are right. If you want a "\"
whithin the brackets you have to write "\\". The AREs are much easier
to use and are more conclusive than the ERE.
------------------------------------------------------------------------
[2002-05-14 19:30:17] rasmus@php.net
No I didn't. The problem has nothing to do with ^ vs. [^
The question is whether \- is a valid way to get a literal - inside
[]'s
------------------------------------------------------------------------
[2002-05-14 16:05:56] postings.php.net@hans-spath.de
@rasmus:
It sounds like you've mistaken "^" for "[^" ...
http://sunsite.utk.edu/gnu/regex/regex_17.html#SEC17
http://sunsite.utk.edu/gnu/regex/regex_23.html#SEC23
------------------------------------------------------------------------
[2002-05-14 12:31:25] rasmus@php.net
A bracket expression is a list of characters enclosed in
`[]'. It normally matches any single character from the
list (but see below). If the list begins with `^', it
matches any single character (but see below) not from the
rest of the list. If two characters in the list are sepa
rated by `-', this is shorthand for the full range of
characters between those two (inclusive) in the collating
sequence, e.g. `[0-9]' in ASCII matches any decimal digit.
It is illegal- for two ranges to share an endpoint, e.g.
`a-c-e'. Ranges are very collating-sequence-dependent,
and portable programs should avoid relying on them.
To include a literal `]' in the list, make it the first
character (following a possible `^'). To include a lit
eral `-', make it the first or last character, or the sec
ond endpoint of a range. To use a literal `-' as the
first endpoint of a range, enclose it in
[.' and .]' to
make it a collating element (see below). With the excep
tion of these and some combinations using `[' (see next
paragraphs), all other special characters, including `\',
lose their special significance within a bracket expres
sion.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/11461
--
Edit this bug report at http://bugs.php.net/?id=11461&edit=1