SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript regular expression

    I want to make sure a field has valid input. The valid
    input for my field should be 6 characters long. The first
    3 are alpha and the last 3 are numeric. Example: AAA001, DYN100

    I have been struggling with this one.

    What is the regular expression test for this input?

    lance

  2. #2
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here ya go: var blah = /^[a-z]{3}[0-9]{3}$/i;

    You also might want to do this: yourInput = yourInput.toUpperCase();
    ck :: bringing chris to the masses.


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
  •