Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    May 2004
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    regular expressions for form validation

    I have the following code:

    PHP Code:
    if (eregi ("([[:alnum:]]) ( ! | @ | # | $ | % | ^ | & | *) {6,12}$"$_POST['password1'])) { 
    I wanted to make sure the password contains alpha-numerics, some special chars, and was between 6 and 12 chars long. the code did work but now it doesn't.

    see anything wrong with the syntax?
    thanks in advance
    c.c.

  • #2
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts
    preg_match('[^a-zA-Z0-9!@#\$%\^&\*]{6-12}', $password);

    SHOULD work. But I'm not the sharpest stick in the box with a RegEx, so double check with someone.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •