Here is my regex. I want to include single quotes (') in characters like (O'Neal Nickel). Here is my regex that allows letters and spaces and complete stops (.) And (-) hyphens
/^[A-Za-z\/\s\.-]+$/;
/^[A-Za-z\/\s\.'-]+$/; Or did I misunderstand your question?
/^[A-Za-z\/\s\.'-]+$/;
Try the following:
/^[A-Za-z\/\s\.'\-]+$/;
You do not need backslash / escape single quote. This will cause Safari to forbid single quotes instead of resolving them.
var testName=/^[A-Za-z\/\s\.'-]+$/; var name= $("#name").val(); if(testName.test(name) == false || name == "") {}
This is the code I used to check the name