How to escape text for regular expression in Java May 2, 2022 by Tarik Since Java 1.5, yes: Pattern.quote("$5");