I would like to remove all special characters (except for numbers) from a string. I have been able to get this far
var name = name.replace(/[^a-zA-Z ]/, \"\"); <
If you don't mind including the underscore as an allowed character, you could try simply:
result = subject.replace(/\W+/g, "");
If the underscore must be excluded also, then
result = subject.replace(/[^A-Z0-9]+/ig, "");
(Note the case insensitive flag)