@Test public void replaceAllWithPatternInstance() { Pattern pattern = Pattern.compile("[a-z]", Pattern.DOTALL + Pattern.CASE_INSENSITIVE); Replacement replacement = new Replacement(pattern, "_"); assertEquals("__", replacement.replaceAll("xY")); }
public String replaceAll(String s) { String result; if (s != null) { result = pattern.matcher(s).replaceAll(replaceWith); } else { result = null; } return result; }
Replacement { public String replaceAll(String s) { String result; if (s != null) { result = pattern.matcher(s).replaceAll(replaceWith); } else { result = null; } return result; } }
Replacement { public String replaceAll(String s) { String result; if (s != null) { result = pattern.matcher(s).replaceAll(replaceWith); } else { result = null; } return result; } Replacement(Pattern pattern, String replaceWith);  Replacement(String pattern, String replaceWith); }
Replacement { public String replaceAll(String s) { String result; if (s != null) { result = pattern.matcher(s).replaceAll(replaceWith); } else { result = null; } return result; } Replacement(Pattern pattern, String replaceWith);  Replacement(String pattern, String replaceWith); static Replacement dotAllNoCase(String pattern, String replaceWith); String replaceAll(String s); }
Replacement { public String replaceAll(String s) { String result; if (s != null) { result = pattern.matcher(s).replaceAll(replaceWith); } else { result = null; } return result; } Replacement(Pattern pattern, String replaceWith);  Replacement(String pattern, String replaceWith); static Replacement dotAllNoCase(String pattern, String replaceWith); String replaceAll(String s);  }