Re: regex newbie question

From: Date: Wed, 23 Oct 2002 18:16:37 +0000
Subject: Re: regex newbie question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-121143@lists.php.net to get a copy of this message
> Hoping someone can help with something probably quite simple > > I am using regex to validate user input this way: > > if (ereg ("^[a-zA-Z0-9\s]+$", $field)) { > $field_validate = TRUE; > } > > I am trying to get the expression to accept upper or lower case letters and > numbers and also allow spaces. It works when I test the expression at > http://regexlib.com/RETester.aspx but I can't seem to get > it to work with > expressions with white space between words or numbers. Anyone have an easy > fix? Replace the \s with just a regular space character. ^[a-zA-Z0-9 ]$ ---John Holmes...

« previous php.general (#121143) next »