At 11/16/2006 08:46 PM, Myron Turner wrote:
The underscore plus alphanumeric are included in \w, so to get a
regex such as you want:
[\w\s\.\-&\']+
You should escape the dot because the unescaped dot stands for any
single character, which is why .* stands for any and all characters.
Not actually. Inside a character class, a dot is just a period. You
may escape it (or any other character) but you don't need to. To
quote the manual:
______________________
Meta-characters
...
In a character class the only meta-characters are:
\
general escape character
^
negate the class, but only if the first character
-
indicates character range
]
terminates the character class
...
Square brackets
...
A closing square bracket on its own is not special. If a closing
square bracket is required as a member of the class, it should be the
first data character in the class (after an initial circumflex, if
present) or escaped with a backslash.
...
All non-alphanumeric characters other than \, -, ^ (at the start) and
the terminating ] are non-special in character classes, but it does
no harm if they are escaped.
______________________
http://ca.php.net/manual/en/reference.pcre.pattern.syntax.php
Regards,
Paul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php