hi,

to validate the name entered by user, i am using this expression "/^[a-zA-Z, ,]/". The name should contain only alphabets and space, if anything other than these two appear in the string, it should output alert msg. Is this expression correct? it is working fine only when numbers are entered, if number is entered along with alphabets, it doesnt work. what changes do i need to do any suggestions pls

thanks

Recommended Answers

All 5 Replies

i figured out how to validate the way i mentioned above.
had to use this expression "/^[a-zA-Z]+\s/"

hi,

i thought i had figured the correct regular expression to check the name, but i was wrong, when i matched the names like nike11 with above mentioned expression, it was matching..initially it wasnt matching as there were some other issues with the codes.
anybody out there, pls help me figure out the correct expression..

Thanks

hi buddy..
try this, it ll surely work..
the expression is this..
[a-zA-Z, ,]*

if u are using .net tech, for building then, go to the property window of the regular expression validator, choose the "display" mode to "dynamic" and then go for another property as "validation expression" as " [a-zA-Z, ,]* ".
and u are done. it will work.
try it and tell..

validation just to enter alphabets and spaces..

it will not work..

try this: [a-zA-Z, ,]*

hey thanks..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.