Re: I lied, another question / problem
| From: | Roman Neuhauser | Date: | Wed, 17 Jan 2007 12:20:27 +0000 |
| Subject: | Re: I lied, another question / problem | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-247205@lists.php.net to get a copy of this message | ||
# jochem@iamjochem.com / 2007-01-17 11:41:54 +0100:
> Roman Neuhauser wrote:
> > # jochem@iamjochem.com / 2007-01-17 01:42:09 +0100:
> >> if (!preg_match("#^[A-Z0-9]+\$#i", $s)) {
> >
> >> (ps the above is a crappy regexp for real world use imho, but it serves
> >> the purpose of example)
> >
> > It's dangerous.
>
> why dangerous?
>
> given that this page:
> http://php.net/manual/en/function.ctype-alnum.php
> says, and I quote:
>
> "Checks if all of the characters in the provided string, text, are
> alphanumeric. In the standard C locale letters are just [A-Za-z] and
> the function is equivalent to preg_match('/^[a-z0-9]+$/iD', $text).
> "
re_format(7) on FreeBSD:
A bracket expression is a list of characters enclosed in `[]'.
(...)
If two characters in the list are separated 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.
(...)
Ranges are very collating-sequence-dependent, and portable programs
should avoid relying on them.
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991