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