I\'m looking for a neat RegEx solution to replace
Well I think you just need to add a quantifier to each pattern. Also the carriage-return thing is a little funny:
text.replace(/[^a-z0-9]+|\s+/gmi, " ");
edit The \s
thing matches \r
and \n
too.
A saw a different post that also had diacritical marks, which is great
s.replace(/[^a-zA-Z0-9À-ž\s]/g, "")