Wednesday, April 11, 2012

RegEx in javascript. Allow only letters, comma and punctuation

I try to make a RegEx for validating a form in javascript. The RegEx should only allow letters comma and punctuation. For instance I have this string:



Hi, this is a test of RegEx. Does it work


I've tried the following



/^[A-Za-z0-9,. ]{3,50}$/; 


But it doesn't seems to work. Solutions?



Thanks!





No comments:

Post a Comment