Re: Anyone good at regular expressions???
| From: | Andreas Pour | Date: | Wed, 23 Aug 2000 20:27:06 +0000 |
| Subject: | Re: Anyone good at regular expressions??? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13211@lists.php.net to get a copy of this message | ||
ssonne wrote:
>
> I've been stumped for a few days at how to write one expression to do the
> following...any help is appreciated.
> I have a name and password form and I want to check that....
> only letters a-z and A-Z and numbers 0-9 are allowed,
> and i'd like to allow the space character, but NOT at the beginning or end
> of the string
>
> I've managed to get it to work, but not in one expression...had to use a
> few, lol
if (ereg("^([[:alnum:]][[:alnum:] ]*[[:alnum:]]|[[:alnum:]])$", $word))
it's OK
else
it's not OK
Untested.
Ciao,
Andreas