Results 1 to 8 of 8

Thread: txtbox validation

  1. #1

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075

    txtbox validation

    I have a txtbox on my web form. I need to check if the second character is a "C" and the next three characters are numeric. Is there a way I can do this with the RegularExpressionValidator?

    thanks,
    eye

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    hmm...I THINK

    [C]\d\d\d

    might be the reg expression.. at least that is the best I can figure out from my book which only has very little info on it

    the [C] mean the letter c and \d mean any digit from 0-9
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    Re: txtbox validation

    Originally posted by EyeTalion
    I have a txtbox on my web form. I need to check if the second character is a "C" and the next three characters are numeric. Is there a way I can do this with the RegularExpressionValidator?

    thanks,
    eye
    oops..second character

    [a-z][c]\d\d\d
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    shorter version

    [a-z][c]\d{3}
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    error message is still popping up. I'm using "[a-z][c]/d{3}" and placing this value in my textbox "1c234"

    I'll keep ya posted...

  6. #6
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    try this one
    [a-zA-Z0-9][cC]\d{3}

    that will let any letter or number(upper or lower case) for first
    c(upper or lower case) for second, then 3 digits.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  7. #7

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    it's working....I was placing a digit in the first value...d'uh!


    thanks

  8. #8
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

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



Click Here to Expand Forum to Full Width