I have created a regular expression for Name validation where only “_”, “-“, “‘“, “. “ allowed.
Here is regular expression:
^[a-zA-Z][a-zA-Z0-9\.\-_']{1,24}$
Problem is this its allowing name having @, Check Fiddle demo:
var str = "deepak@";
var str2 = "@@";
alert(str.match("^[a-zA-Z][a-zA-Z0-9\.\-_]{1,24}$"));//allowing why?
alert(str2.match("^[a-zA-Z][a-zA-Z0-9\.\-_]{1,24}$"));//not allowing
Expected: Name having @ should not allow.
Note: When i tested this regex in https://regex101.com/#javascript its working good