I\'m trying to figure out the regular expression that will match any character that is not a letter or a number. So characters such as (,,@,£,() etc ...
Once found I
Have you tried str = str.replace(/\W|_/g,'');
it will return a string without any character and you can specify if any especial character after the pipe bar |
to catch them as well.
var str = "1324567890abc§$)% John Doe #$@'.replace(/\W|_/g, '');
it will return str = 1324567890abcJohnDoe
or look for digits and letters and replace them for empty string (""):
var str = "1324567890abc§$)% John Doe #$@".replace(/\w|_/g, '');
it will return str = '§$)% #$@';