I have a this regular expression below for some input name fields. How do I include an apostrophe and a hyphen in this?
InputField("tFName", /^[a-zA-Z-\-\ ]+$/);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Hyphen is already included (twice), you can add the apostrophe by just editing it into the character class:
You can rewrite it to look like this, so that there’s no need to escape the hyphen and it’s only included once:
Example: http://jsfiddle.net/a4vGA/