List of utility methods to do Regex Match
boolean | checkPattern(String pattern, String value) Check a String with a pattern Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(value);
return m.matches() ? true : false;
|
int | getNumber(String string) get Number int result = 0; Matcher m; String regEx = "[^0-9]"; Pattern p = Pattern.compile(regEx); if (string != null) { m = p.matcher(string); result = Integer.valueOf(m.replaceAll("").trim()); return result; |