Help with Regular Expression Validator

Last post 07-30-2007 12:53 AM by M A A Mehedi Hasan. 2 replies.

Sort Posts:

  • Help with Regular Expression Validator

    07-28-2007, 1:22 PM

    Here is what I want to accomplish:

    1- User must enter 1 - 250 characters (numbers, letters, symbols, blank spaces)

    2- User must enter 1-7 lines (if user hit the "enter" key for the 8th line, the expression would catch it)

    Here is what I have so far:

     (.|\r|\n){1,255}

    Can you please help me?

     

  • Re: Help with Regular Expression Validator

    07-29-2007, 11:19 PM
    Answer
    • Loading...
    • Sweeperq
    • Joined on 01-04-2006, 9:58 PM
    • Madison, WI
    • Posts 493

    Someone can correct me if I'm wrong, but I beleive the Regex Validator does not validate on empty text--so you actually need an empty field validator as well.

    With regards to your regex, I'm not sure how to catch it w/ 1 validator, but you could try breaking it up into two. 1 to test the overall length, and 2 to text the pattern.

    Remember that . matches any character, including \r and \n.  To match any character excep those, use [^\r\n].

    When your question has been sufficiently answered, please be sure to mark your question as answered. Also, please share your solution if you had to figure it out on your own!
  • Re: Help with Regular Expression Validator

    07-30-2007, 12:53 AM
    Answer

    Hi,

    I think you may get some help from here ,

     

    http://regexlib.com/DisplayPatterns.aspx
    http://www.regular-expressions.info/

     

    Mehedi Hasan


    Mark as answer if the post meets your requirement!
Page 1 of 1 (3 items)
Microsoft Communities
Page view counter