Regex To Get All Alpha Numeric Fields Except For Comma, Dash And Single Quote
I am trying to strip out all non alpha numeric characters except for comma, dash and single quote. I know how to remove all non words from a string i.e myString.replace(/\W/g,'');
Solution 1:
\w
is the inverse of \W
, so you can just use /[^\w,'-]/
EDIT: in case underscore is also not desired: /[^\w,'-]|_/
Post a Comment for "Regex To Get All Alpha Numeric Fields Except For Comma, Dash And Single Quote"