MoniMatthews
asked on
How do I add a match for a period in a Regular Expression Validator
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>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
[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
ASKER
Thanks
\.
or put inside a range [.], inside the [] the . dot is literal