Re: form validation :ereg ()
| From: | Jeff Warrington | Date: | Tue, 30 Jan 2001 01:55:22 +0000 |
| Subject: | Re: form validation :ereg () | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-37212@lists.php.net to get a copy of this message | ||
In article <F62eq5Z3JjQWrBSXaD800004bee@hotmail.com>, "kaab kaoutar"
<kaab_k@hotmail.com> wrote:
If you wish to include a hyphen in the allowed character list of a
pattern match, you must include it as the last character.
So what you want should be more like:
if (eregi("[^a-zA-Zëàéêêàäïüöûâç-]",$name)) {
print("your name can't include non-letter, etc....");
}
You can add space with: [:space:] within the charachter
class ([^a-zA-Z[:space:]ëàéêêàäïüöûâç-])
Jeff
> Hi again!
>
> I still did not fix my prob : I want to check, in a form, that the name
> input may include an alphabetical letter a- z, A-Z, or a space, or -,
> or à, or ä or ü etc how can i do that ? i used
> ereg("([a-z,A-Z][ë,à]?)",$name) then
> (!ereg("([a-z,A-Z,é,ê,è,ë,-,\t,à,ä,ï,ü,ö,û,â,ç])", $name))
> i get the following warnin :REG_ERANGE:,invalid character range by the
> way how to add space " " and "-" ?
>
> Please help!
>
> Thanks
>
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at
> http://www.hotmail.com.
>
>
>