How do I add a match for a period in a Regular Expression Validator

Posted on 2009-04-27
Last Modified: 2012-05-06
I have an expression: [a-zA-Z\s0-9]{0,500}, it as long as I don't enter a period character. How do I add a the option for a period character?
<asp:RegularExpressionValidator ID="revSN" runat="server" ControlToValidate="txtSN" ErrorMessage="Please eneter a vaild information in this field." ValidationExpression="[a-zA-Z\s0-9]{0,500}"></asp:RegularExpressionValidator>

Open in new window

Question by:MoniMatthews
    LVL 40

    Expert Comment

    Escape it with a \


    or put inside a range [.], inside the [] the . dot is literal
    LVL 40

    Accepted Solution



    Open in new window

    LVL 39

    Expert Comment

    Rather than


    You could trye


    \d, \w and \s      Shorthand character classes matching digits, word characters, and whitespace. Can be used inside and outside character classes.

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    Using Quotation Marks in PHP This question ( seems to come up a lot for developers who are new to PHP.  And it got me thinking, "How can we explain the rule…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now