Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends ,
I have a problem regarding regular expression .I have to validate a user name ,
with following requirements
1. It will accept only alpha numeric value.
2. Starting with a character value.
3. Accepting minimum 5 values.
How can i do it .
Please help me .
Thanks all in advance.
Posted
Updated 5-May-11 21:12pm
v2

try this

XML
<asp:TextBox ID="TextBox1" MaxLength="5"  runat="server"></asp:TextBox><asp:RegularExpressionValidator
           ID="RegularExpressionValidator1" ControlToValidate="TextBox1" ValidationExpression="^[A-Za-z]\w*" runat="server" ErrorMessage="RegularExpressionValidator"></asp:RegularExpressionValidator>
           <asp:Button ID="btn" Text="Check" runat="server" />
 
Share this answer
 
Comments
pawanvats 6-May-11 4:41am    
It Should accept minimum 5 values not maximum
Mahendra.p25 6-May-11 4:49am    
try this

ValidationExpression="^[A-Za-z]{5}\w*"
Hope this[^] might help you.

Validate it accordingly as per your requirement.
 
Share this answer
 
Comments
pawanvats 6-May-11 3:18am    
Thanks sir,But MR. Ramalinga it is not validating for minimum 5 character and starting with character value

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