2nd bug no-one has mentioned yet: the regex matches anywhere in the string, so for example, isValidName('叽叽喳喳 o_O 咔嚓咔嚓咔嚓') is true, because the o_O in the middle matches.
isValidName('叽叽喳喳 o_O 咔嚓咔嚓咔嚓')
true
o_O
Good catch, that's my mistake. When simplifying the example for this post I must've missed that.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
2nd bug no-one has mentioned yet: the regex matches anywhere in the string, so for example,
isValidName('叽叽喳喳 o_O 咔嚓咔嚓咔嚓')
istrue
, because theo_O
in the middle matches.Good catch, that's my mistake. When simplifying the example for this post I must've missed that.