Advertisement
christiansalazarh

sanitize an input string using regexp

Jul 17th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function _sanitize_input_string(s) {
  2.     return s.replace(/([^a-z0-9 .,-_])+/gi, " ")
  3.     .replace(/[\/\\\[\]\?\¿\:]/g," ")
  4.     .replace(/\s+/g," ")
  5.       ;
  6. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement