keep alpha numerics and keep alpha numerics spaces difference in java code example Example: regex remove all non alphanumeric except spaces /[^[:alnum:]\x20/gi