Skip to content

Instantly share code, notes, and snippets.

@joshterrill
Created June 30, 2015 22:11
Show Gist options
  • Save joshterrill/d09010fc678951d9d5ec to your computer and use it in GitHub Desktop.
Save joshterrill/d09010fc678951d9d5ec to your computer and use it in GitHub Desktop.
valid filename regex
var str = '// \\ / \ _ - . ( ) () &&& !@#$%^&*)*_+=this is a test #$^*#<><>[][]{}{}{}{)(*#@';
var result = str.replace(/_|#|\\|\/|-|\.|\ |\(|\)|\&|\@|\!|\$|\%|\^|\*|\+|\=|\[|\]|\{|\}|\'|\"|\<|\>|\?|/g,'');
console.log(result);
// thisisatest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment