Re: How to validate a name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry, my regex was incomplete...

$nick = "a9100948_aslkasjkf.asd";
for ($i=0;$i<10;$i++) { $total += substr_count($nick, $i); }
echo  ereg("^[^0-9][A-Za-z0-9_.]{5,26}$", $nick) && $total <= 5 ? "ok" : 
"error";

=]

Jony dos Santos Kostetzer
Joinville/SC/Brazil

Em Qua 08 Fev 2006 12:53, Francisco - São Paulo - Brazil escreveu:
>  I have already this working fine:
>  $nick_ok = ereg("^[A-Za-z0-9_.]{5,26}$", $form['NICKNAME']);
>
>  What I need:
>  - It can not start with numbers
>  - It can not have more than 5 numbers
>
>  How can I do that?
>
>  Jony dos Santos Kostetzer escreveu:
>  > Hi!
>  >
>  > You can use:
>  >
>  > if (preg_match('/[a-z0-9]/i', $variable)) {
>  >       //OK
>  > } else {
>  >       //problem
>  > }
>  >
>  > []'s
>  >
>  > ======================================
>  > Jony dos Santos Kostetzer
>  >
>  > Pesquisa & Desenvolvimento /  Research & Development
>  > A2C Internet para Negócios  / A2C Internet to Business
>  > www.a2c.com.br
>  > ======================================
>  >
>  > Em Qua 08 Fev 2006 09:47, Francisco - São Paulo - Brazil escreveu:
>  > >  Sorry for asking for something so basic, but I am really bad in
>  > > regexp.
>  > >
>  > >  I would like to validate a text typed , it must have:
>  > >  A-Z
>  > >  a-z
>  > >  0-9
>  > >  _-
>  > >
>  > >  Example: Frank_23z
>  > >
>  > >  Thanks in advance
>  > >
>  > >
>  > >  PHP Data object relational mapping generator
>  > >  http://www.metastorage.net/
>  > >
>  > >
>  > >
>  > >
>  > > SPONSORED LINKS
>  > >
>  > > Programming languages
>  > > Object oriented programming
>  > > Php developer
>  > >
>  > >
>  > > Computer security
>  > > C programming language
>  > > Computer programming languages
>  > >
>  > >
>  > >
>  > >  YAHOO! GROUPS LINKS
>  > >
>  > >
>  > >  Visit your group "php-objects" on the web.
>  > > 
>  > >  To unsubscribe from this group, send an email to:
>  > >  php-objects-unsubscribe@xxxxxxxxxxxxxxx
>  > > 
>  > >  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>  >


PHP Data object relational mapping generator
http://www.metastorage.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux