0

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

Edited by puvi: n/a

2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by puvi
0

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

0

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

0

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..

0

validation just to enter alphabets and spaces..

it will not work..

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.