Regular Expression to remove everything but characters and numbers December 29, 2023 by Tarik There’s probably a more concise regex, but this will certainly work: string.replaceAll("[^a-zA-Z0-9]", "");