Re: form validation :ereg ()

From: Date: Tue, 30 Jan 2001 17:44:33 +0000
Subject: Re: form validation :ereg ()
Groups: php.general 
Request: Send a blank email to php-general+get-37334@lists.php.net to get a copy of this message
Hi! no it dose not work! now it even not accepts kaab ? for the space, what i mean is that the user won't insert space only !
From: jaydub <jaydub@bossanova.com> To: kaab kaoutar <kaab_k@hotmail.com> Subject: Re: [PHP] form validation :ereg () Date: Tue, 30 Jan 2001 09:21:09 -0800 (PST) The patter will allow numbers because we didn't explicitly put numbers in the charachter clas. To avoid allowing numbers, add in '0-9' to the beginning of the bracketed expression: [^0-9a-zA-z.....] etc to disallow spaces at the beginning, the easiest thing is to trim the input. so, if you have a posted variable with the value: ' myname', then reassign the variable like: $name = trim($name); this will removed leading and trailing spaces. Jeff => Hi! => thanks for the answer ! => but for eregi("[^a-zA-Z[:space:]ëàéêêàäïüöûâç-]",$name); => it accespts also numbers hen i give kaab1 as input it accept it ? strange ?! => by the way how can i add the fact that the name should not start with space => ? => thanks a lot ! => => => => >From: "Jeff Warrington" <jaydub@bossanova.com> => >To: php-general@lists.php.net => >Subject: Re: [PHP] form validation :ereg () => >Date: Mon, 29 Jan 2001 17:55:22 -0800 => > => >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. => > > => > > => > > => > => >-- => >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 => > => => _________________________________________________________________________ => Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. =>
_________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

« previous php.general (#37334) next »