SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Hybrid View

  1. #1
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I want to check words that have these requirements:
    + lowercase
    + no vowel
    + no long listing (of non-vowel chars)

    Thanks
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What do you mean by long listing 3 or more? Of the same letter?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by freddydoesphp
    What do you mean by long listing 3 or more? Of the same letter?
    3 or more?? That's not in my requirement.
    So these examples might help clarifying:
    bbb -> accept
    xyz -> accept
    abb -> reject
    Bbb -> reject

    and for the 3rd requirement, in the pattern, there shouldn't be: [bcdfghjkl...xyz] (all non-vowel chars)
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry about that I was confused well many is too long a listing? That was my original question
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  5. #5
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just in case you're still waiting for the answer, the pattern should NOT include a listing of all non-vowel characters (but any shorter listing is fine)

    Thanks
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  6. #6
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh okay here ya go

    $words = "dfkjhdfjh";

    if (ereg("^[A-Z].+$|[A,E,I,O,U,a,e,i,o,u]{1,}", $words)) {
    print "Error";
    }
    else {
    print "Okay";
    }
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  7. #7
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply,
    It fails if the input is number or special character. Example: #2
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  8. #8
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if (!ereg("^[a-z]{1,}$", $words)) {
    print "Error";
    }
    else {
    print "Okay";
    }

    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  9. #9
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And this just simply ignore the 2nd requirement (no vowel)
    Sorry Freddy, I am not just giving someone my problem and sit there to see the result.
    I thought about it but so far couldn't make my way around having to list all the valid lower case (which are non-vowel)
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  10. #10
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So then

    $words = "dfkjhdfjh";

    if (ereg("^[A-Z].+$|[A,E,I,O,U,a,e,i,o,u]{1,}", $words)) {
    print "Error";
    }
    else {
    print "Okay";
    }

    Should work and you can jsut add in the punctuation and numbers like

    if (ereg("^[A-Z].+$|[A,E,I,O,U,a,e,i,o,u,\$,#,*]{1,}|[0-9]{1,}", $words)) {
    print "Error";
    }
    else {
    print "Okay";
    }
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

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