Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2009-04-27
4
Medium Priority
?
256 Views
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

0
Comment
Question by:MoniMatthews
  • 2
4 Comments
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24243226
Escape it with a \

\.

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

Accepted Solution

by:
mrjoltcola earned 2000 total points
ID: 24243233

[a-zA-Z\s0-9.]{0,500}

Open in new window

0
 
LVL 40

Expert Comment

by:evilrix
ID: 24243487
Rather than

[a-zA-Z\s0-9.]{0,500}

You could trye

[\d\w\s.]{0,500}

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

http://www.regular-expressions.info/reference.html
0
 

Author Closing Comment

by:MoniMatthews
ID: 31575034
Thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
This video teaches users how to migrate an existing Wordpress website to a new domain.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.
Suggested Courses

804 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