I forgot to delete the modifier I in the template, which should cross out non-alphanumeric characters:
str.replace(/[\W_]+/gi," ");
And I thought that [\W_] would match i , k and with + quantifier even s : D
Without a modifier, I am working fine. And of course, the modifier I am a mistake, but I do not understand this strange behavior: regex101 and here is the fiddle
I am using Firefox 32.0.1


source share