Escape Characters in Regular Expressions March 6, 2019 In Java, characters as cannot appear in a regular expression without being escaped. For this, rely on the Pattern.quote() method as in the following example: public static boolean contains(String t1, String