CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2005
    Posts
    53

    How to validate using RegularExpressionValidator

    Hi everyone,

    I'm using ASP.NET and i designed a page which contains many text boxes. I've used RegularExpressionValidator for validation.

    Now i want to validate a text box which should accept alphabets (a-z and A-Z), comma(,), dot(.), open bracket((), close bracket()), blank space and hypen(-) in any order.
    eg. SD.RE - (ad.sd., sd.we.,)

    To accept all these characters, how to write a expression.


    Can anyone help me.

    -haifriends.

  2. #2
    Join Date
    Dec 2004
    Posts
    25

    Re: How to validate using RegularExpressionValidator

    This is ur need:
    Expression
    ((\w|\W)(\w|\W)(.))*

    Ok good luck.

  3. #3
    Join Date
    Dec 2005
    Posts
    53

    Re: How to validate using RegularExpressionValidator

    Quote Originally Posted by hany_3210
    This is ur need:
    Expression
    ((\w|\W)(\w|\W)(.))*

    Ok good luck.
    Thank you.

    This accepts only 3 characters, but i need expression that accepts more than 3 characters. Characters should not accept numbers(0-9), special characters such as #, @, $, %, !.....
    Should accept alphabets, space, hypen(-), dot(.), comma(,), open bracket and close bracket.

    Can anyone help me.

    -haifriends.

  4. #4
    Join Date
    Mar 2007
    Posts
    1

    Re: How to validate using RegularExpressionValidator

    I'm not sure if it works but try this simple regular expression: [A-Za-z,.()- ]*

  5. #5
    Join Date
    Jun 2003
    Location
    Toronto
    Posts
    805

    Re: How to validate using RegularExpressionValidator

    why dont you go to the Regex Library Website. theres literally thousands of Regex expressions catalogued and there is a regex tester, its certinally more helpful than posting messages to an unrelated forum trying to get your answers.

    http://regexlib.com/

    hth,
    mcm
    rate my posts!
    mcm

  6. #6
    Join Date
    Dec 2008
    Posts
    3

    Re: How to validate using RegularExpressionValidator

    As post regarding Regular Expression Validator, I kindly request you let me know which code is exactly match to you validation string......

    thanks

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

Featured