Click here to Skip to main content
15,844,498 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how i make a text field allow numbers,charecters,special charecters .

What I have tried:

<input id="txtBillNo" runat="server" type="text" style="width: 171px" maxlength="20" />
                    <asp:RegularExpressionValidator ID="revBillNo" runat="server" ControlToValidate="txtBillNo"
                                Display="Dynamic" ErrorMessage="Check Bill No" SetFocusOnError="True" ValidationExpression="^((A-Za-z0-9])*$"></asp:RegularExpressionValidator></td>
Updated 1-Sep-22 20:01pm

1 solution

You change this bit:
To include the characters you want to allow.
At present, that doesn't work: the brackets aren't matched up as you have two '(', one ')' and one ']'. I suspect it should be:

Which allows upper- and lower-case letters, plus numeric digits only.

Get a copy of Expresso[^] - it's free, and it examines and generates Regular expressions. It'll help you work out and test exactly what you need to do.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900