Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

regular expression validation

Guest
Apr 24, 2007 Apr 24, 2007
i have a form password to be server validated
the password needs to be at least 8 characters with at least 1 being numeric.

this expression example that i found is supposed to be 6-8 characters with at least 1 letter

/^(?![0-9]{6,8})[0-9a-zA-Z]{6,8}$/

can anyone help change this expression to match my requirements?

i can see the {6,8} being {8,9} but not sure of the other changes?

thanks for your help
jim balthrop
TOPICS
Server side applications
265
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 24, 2007 Apr 24, 2007
Try:
^(?=.*[A-Za-z])(?=.*[\d])(?!.*[A-Za-z0-9])(?!.*s).{8,}$

That should require at least 8 characters with one digit.
It might be easier just to do separate tests, though. Up to you, really.

Pseudocode:
If Len(password) >= 8
RegExp = "[\D]"
stripped password = RegExp.Replace(password,"")
If Len(stripped password) > 0
OK!
Else
You forgot to include a number!
End
Else
That's not long enough
End


"jim balthrop" <webforumsuser@macromedia.com> wrote in message
news:f0lpte$blc$1@forums.macromedia.com...
>i have a form password to be server validated
> the password needs to be at least 8 characters with at least 1 being
> numeric.
>
> this expression example that i found is supposed to be 6-8 characters with
> at
> least 1 letter
>
> /^(?![0-9]{6,8})[0-9a-zA-Z]{6,8}$/
>
> can anyone help change this expression to match my requirements?
>
> i can see the {6,8} being {8,9} but not sure of the other changes?
>
> thanks for your help
> jim balthrop
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 24, 2007 Apr 24, 2007
LATEST
couldn't get that to work but i did find the answer on line

i found this expression for at least 1 numeral and at least 1 letter
/^\w*(?=\w*\d)(?=\w*[a-z])\w*$/

i ended up applying a seperate validation for the minimum characters of 8 and applied both the entry length and the regular expression validation to the password textbox

thanks for your help; it pointed me in the right direction
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines