Forgot to remove the i modifier in a pattern, that should strip out non alphanumeric characters:
str.replace(/[\W_]+/gi," ");
And wondered, that [\W_] will match i,k and with + quantifier even s :D
Without the i modifier it's working fine. And of course the i modifier is a mistake, but I don't understand this weird behavior: regex101 and here is a fiddle
I'm using Firefox 32.0.1


It's a bug that affects Firefox 32.0 and 32.0.1.
It has already been fixed on Firefox 33 Beta.
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