Re: Preg_match.
| From: | Cynic | Date: | Fri, 08 Dec 2000 18:07:38 +0000 |
| Subject: | Re: Preg_match. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29381@lists.php.net to get a copy of this message | ||
Actually, this matches nothing, at least on my computer.
You need to set the minimum count in the repetition
( {0,18} ), and you can use the PCRE_CASELESS option to
shorten the pattern:
'/^[0-9a-z][0-9a-z._]{0,18}[0-9a-z]$/i'
BTW, in PHP, PCRE regular expressions are about twice as
fast as the POSIX ones.
At 18:43 8.12. 2000, Ignacio Vazquez-Abrams wrote the following:
--------------------------------------------------------------
>On Fri, 8 Dec 2000, Monte Ohrt wrote:
>
>
>No, that won't do it either. Try:
>
>/^[0-9a-zA-Z][0-9a-zA-Z._]{,18}[0-9a-zA-Z]$/
>
>FYI, you probably have your reason(s) for using preg, but here's the
>equivalent in ereg:
>
>^[[:alnum:]][[:alnum:]._]{,18}[[:alnum:]]$
>
>--
>Ignacio Vazquez-Abrams <ignacio@openservices.net>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
------end of quote------
____________________________________________________________
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