Re: Regular expression

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

 



On Tue, Feb 14, 2006 at 10:53:17PM +0100, Patrick wrote:
> Hi,
> 
> I am trying to validate a password, but havent figured out the pattern for 
> it yet.
> The password must contain atleast 6 characters
> a-zA-Z0-9_
> must start with a
> a-zA-Z
> and must have atleast one of the following characters
> !#%&$�
> 
> correct passwords would be:
> a#aAb08
> Plkpod!
> t09_#8T
> U_p#q#Pq
> 
> i was trying something like this, but it dosent seem to work:
> ^[a-zA-Z]{1}[!#%&$]+[a-zA-Z0-9_]+

Trying to write a regex with that ruleset i think would be a rather
complicated beast, besides you might want to give some feedback
based on why it is not a valid password. 

Basically:
  ok = false

  if ! /^[a-z]{1}[a-z!#%&$_]{5,}$/i
    your password doesnt follow the format required

  else
    if strlen(pass) < 32 # assuming 32 char limit
      password to long

    else if pass doesnt have !#%&$�
      i'm forcing you to use a char you maynot want in your
      password
    
    else
      ok = true

Curt.
-- 
cat .signature: No such file or directory

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux