quick help needed on regular expression validator

Discussion in 'ASP .Net' started by David Cho, Feb 14, 2005.

  1. David Cho

    David Cho Guest

    I am looking to use the input in the text box in the IN SQL clause (for
    example, "WHERE studentID in (233, 3422, 43232)")

    So I need the validator to validate

    number, number, number, number

    So acceptable
    343435, 2232, 333, 3434

    Not acceptable
    - ,343,3434,3434, (nos comma before the string and after)
    - r54, e3233 (alphas mixed in)
    - 3232|12121|2232 (wrong delimiter)

    Thank you very much. I plan on studying regular expressions soon, but
    this is pretty urgent.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    David Cho, Feb 14, 2005
    #1
    1. Advertising

  2. David Cho

    Wilco Bauwer Guest

    Try something like: "\(\d+(,\s*\d+)*\)"

    Basically it means:
    - Match a literal '('
    - Match a digit (\d), once or more (+)
    - Match a comma, 0 or more (*) spaces followed by at least (+) 1 digit
    (\d) - Match this 0 or more times.
    - Match a literal ')'

    HTH.
    Wilco Bauwer, Feb 14, 2005
    #2
    1. Advertising

  3. 343435, 2232, 333, 3434

    Not being very good at them myself I'll take a guess
    at.........."[0-9],[0-9],[0-9],[0-9]" - which should give you four numeric
    ranges from 0 through 9 seprated by commasor being very specific
    ...........(another guess)...........individual pattern of specific digits

    "\d\d\d\d\d\d,\d\d\d\d,\d\d\d,\d\d\d";

    --
    Regards

    John Timney
    ASP.NET MVP
    Microsoft Regional Director

    "David Cho" <> wrote in message
    news:%...
    > I am looking to use the input in the text box in the IN SQL clause (for
    > example, "WHERE studentID in (233, 3422, 43232)")
    >
    > So I need the validator to validate
    >
    > number, number, number, number
    >
    > So acceptable
    > 343435, 2232, 333, 3434
    >
    > Not acceptable
    > - ,343,3434,3434, (nos comma before the string and after)
    > - r54, e3233 (alphas mixed in)
    > - 3232|12121|2232 (wrong delimiter)
    >
    > Thank you very much. I plan on studying regular expressions soon, but
    > this is pretty urgent.
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    John Timney \(ASP.NET MVP\), Feb 14, 2005
    #3
  4. David Cho

    David Cho Guest

    I would like to get it to work without the beggning and ending
    paranthesis. I can't figure it out.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    David Cho, Feb 15, 2005
    #4
  5. David Cho

    David Cho Guest

    Is there a way to ignore carriage returns?


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    David Cho, Feb 15, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Vallelunga
    Replies:
    2
    Views:
    8,265
    Brian Vallelunga
    Jul 31, 2003
  2. VSK
    Replies:
    2
    Views:
    2,266
  3. Bryce Budd

    Regular Expression Validator

    Bryce Budd, Sep 18, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    565
    Brian Davis
    Sep 18, 2003
  4. Simple Simon
    Replies:
    2
    Views:
    4,327
    Simple Simon
    Nov 4, 2003
  5. Edward
    Replies:
    0
    Views:
    820
    Edward
    Dec 4, 2003
Loading...

Share This Page