Edited based on your update:
dirtyString.replaceAll("[^a-zA-Z0-9]","")
More Related Contents:
- What do the characters ((?:(?:(?: mean in pattern-matching? [duplicate]
- Java: splitting a comma-separated string but ignoring commas in quotes
- Split string with dot as delimiter
- Use String.split() with multiple delimiters
- Java how to replace 2 or more spaces with single space in string and delete leading and trailing spaces
- Java Regex Capturing Groups
- SCJP6 regex issue
- Get the index of a pattern in a string using regex
- Regular expression for excluding special characters [closed]
- How to determine if a number is a prime with regex?
- Java regex to extract text between tags
- Java regex: Repeating capturing groups
- Why does this Java regex cause “illegal escape character” errors?
- java.util.regex – importance of Pattern.compile()?
- Any character including newline – Java Regex
- How do I create a Stream of regex matches?
- simple java regex throwing illegalstateexception [duplicate]
- Range of valid character for a base 64 encoding
- Regex: ?: notation (Question mark and colon notation) [duplicate]
- Whats the difference between \z and \Z in a regular expression and when and how do I use it?
- Regex reuse a pattern to capture multiple groups?
- Regex for checking if a string is strictly alphanumeric
- Character class subtraction, converting from Java syntax to RegexBuddy
- Advanced Wildcard Mappings Parameters not found in Prepare() method
- Java Regex pattern that matches in any online tester but doesn’t in Eclipse
- Java Pattern Matcher: create new or reset?
- String.replaceAll is considerably slower than doing the job yourself
- Remove all occurrences of \ from string
- Extract ip addresses from Strings using regex
- Validate if input string is a number between 0-255 using regex