How to filter string for unwanted characters using regex?

Edited based on your update:

dirtyString.replaceAll("[^a-zA-Z0-9]","")

Leave a Comment