Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
can anybody tell me how to validate name textbox with regular expression validation.
so that it can take only alphabets and space
Posted
Updated 26-Sep-19 21:17pm

The following regular expression can be used for the above purpose
^[a-zA-Z\s]+$
 
Share this answer
 
Comments
VJ Reddy 4-May-12 6:32am    
It works. You can test it here http://regexhero.net/tester/
In C# either use @"^[a-zA-Z\s]+$" or "^[a-zA-Z\\s]+$"
Member 12222516 18-Jan-17 2:47am    
No comment
Member 12222516 18-Jan-17 2:47am    
_gbg_gb
pck.ns 4-May-12 6:53am    
sorry for first but now its working...............thanx
VJ Reddy 4-May-12 7:07am    
You're welcome and thank you for accepting the solution and response.
Here u can use this

^[a-zA-Z][a-zA-Z\\s]+$
 
Share this answer
 
Comments
pankaj kumar priyadarshi 20-Oct-15 3:05am    
I want Stop special char,spaces and digits or allow only hindi and english chars
You Can try this


^[a-zA-Z][a-zA-Z\\s]+$

or go to Link:-

validation expression for name in regular expression validation[^]
 
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