Results 1 to 3 of 3

Thread: regular expression validator

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2005
    Posts
    41

    Angry regular expression validator

    I have a small problem. I have a form called customer master. I have a textbox control which is supposed to accept the phone number. The phone number can accept hyphen , but not at the beginning. It can begin with + at the beginning. Other than these two it should accept only numbers. I want to know how to validate this at run time not at design time.

    can anyone help me with this.

    Thanking you,

    Sai abhiram Bandhakavi.

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: regular expression validator

    Use this as the ValidationExpression property:
    (\+\d{3}-\d{3}-\d{4}|\d{3}-\d{3}-\d{4})

    Don't forget to set your ControlToValidate property

  3. #3
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: regular expression validator

    This tool might help you out in future - it allows you to test your regular expressions quickly. Also there is a search facility for existing regular expressions.

    http://sourceforge.net/projects/regulator/

    HTH

    DJ

    If I have been helpful please rate my post. If I haven't tell me!

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