dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Trying to get a few more regular expressions to work

Hybrid View

  1. #1
    Join Date
    May 2006
    Posts
    140

    Trying to get a few more regular expressions to work

    I have stripped all PHP surrounding the following regular expressions components but it basically decides to put these parts into one big expression bassed on certain variables and that puts that into a preg_match_all():

    $\S* // Start of the expression

    (?=\S{6,}) // Minimum length = 6

    (?=\S*[a-z]) // Requires lowercase letters

    (?=\S*[A-Z]) // Requires uppercase letters

    (?=\S*[\d]) // Requires digits

    (?=\S*[\W]) // Requires special characters

    $ // End of the expression

    There are just a few expressions I can't get to work:

    - Maximum length (If I fill in a number after the 6, the string is still validated, even if it's longer than that. Example: {6,32} still validates a string longer than 32 characters )
    - No lowercase letters allowed
    - No uppercase letters allowed
    - No digits allowed
    - No special characters allowed

    I've tried googling how to do thos but I couldn't come up with the right way to do it, so any help would be greatly appreciated.

  2. #2
    Join Date
    May 2006
    Posts
    140
    (Couldn't edit)

    Basically, what I'm looking for are the expressions for this:


    if (lowercase letters are allowed){

    if (lowercase letters are required){
    $phrase .= *LOWERCASE REQUIRED EXPRESSION*;
    }

    }

    else{
    $phrase .= *LOWERCASE DENIED EXPRESSION*;
    }


    For these types:

    - Lowercase
    - Uppercase
    - Numbers
    - Special characters

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles