DEV Community

Discussion on: Can you find the bug in this piece of code? - RegExp edition 🌍

Collapse
 
lionelrowe profile image
lionel-rowe

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.

Collapse
 
nombrekeff profile image
Keff

Good catch, that's my mistake. When simplifying the example for this post I must've missed that.