Hi I have been playing with this regex for a few hours now I want to make it so it accepts commas also any ideas?

var regname=/^[a-zA-Z\.\-\'\s]*$/;

At the moment it works with A-z and - . ' but can't seem to figure out how to include commas :(

What do you want to match? You could just add a comma in it. Though, I'm not sure if the regexp you are using really covers all cases you want.

var regname=/^[A-Za-z,\.\-\'\s]*$/

Not sure what you are trying to match for... You use * which means you also accept an empty string. You seem to try to check whether the string does not contain a number? You could just check if the string contain a number instead. If the string contain a number, reject it.

var regname=/\d/

If you want to check a string contains only characters and/or white space, you could use short hand form as well.

var regname=/^[,\w\s\-\.\']*$/

thank you don't think many people have numbers in their names and i never heard of anyone having an underscore in their name only A-z comma aphostrophe or hyphen maybe a fullstop if they hav a number in their name 4 would be IV

Ah ok, then you should not use * but + instead. Also, you should not use \s because that would include new line as well. However, I would test for illegal characters instead because there are less...

sorry maybe i should have started a new thread but how can i disallow characters $ % @ ! ? { }