@Test public void validate_shouldReturnTrue_whenRegexStringIsValidString() throws Exception { str = "abc"; assertEquals(true, regexMatcher.validate(str, "[a-zA-Z]+")); }
public boolean validate(String dataStr, String regex) { if (regex == null || regex.equals("")) { throw new IllegalArgumentException("regex field cannot is be null or empty!"); } else { Pattern p = Pattern.compile(regex); return validate(dataStr, p); } }
RegexMatcher { public boolean validate(String dataStr, String regex) { if (regex == null || regex.equals("")) { throw new IllegalArgumentException("regex field cannot is be null or empty!"); } else { Pattern p = Pattern.compile(regex); return validate(dataStr, p); } } }
RegexMatcher { public boolean validate(String dataStr, String regex) { if (regex == null || regex.equals("")) { throw new IllegalArgumentException("regex field cannot is be null or empty!"); } else { Pattern p = Pattern.compile(regex); return validate(dataStr, p); } }  }
RegexMatcher { public boolean validate(String dataStr, String regex) { if (regex == null || regex.equals("")) { throw new IllegalArgumentException("regex field cannot is be null or empty!"); } else { Pattern p = Pattern.compile(regex); return validate(dataStr, p); } }  boolean validate(String dataStr, String regex); boolean find(String dataStr, String regex); boolean validate(String dataStr, Pattern pattern); boolean find(String dataStr, Pattern pattern); }
RegexMatcher { public boolean validate(String dataStr, String regex) { if (regex == null || regex.equals("")) { throw new IllegalArgumentException("regex field cannot is be null or empty!"); } else { Pattern p = Pattern.compile(regex); return validate(dataStr, p); } }  boolean validate(String dataStr, String regex); boolean find(String dataStr, String regex); boolean validate(String dataStr, Pattern pattern); boolean find(String dataStr, Pattern pattern);  }