My Regex is:
var re = /^[a-z A-Z._]{1,15}$/;
I want to allow this: ' (Single Quote).
How can I do this?
You can use the following regex for example to allow a string like abcd'dfgh:
/^[A-Za-z\/\']+[A-Za-z]$/
To allow single quote, add it in the character class like ^[a-z A-Z._']{1,15}$
This regex allows ' matching 'abc'_, a'b'c_ etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With