public RegexResult selectGroup(String text) { Matcher matcher = regex.matcher(text); if (matcher.find()) { String[] groups = new String[matcher.groupCount() + 1]; for (int i = 0; i < groups.length; i++) { groups[i] = matcher.group(i); } return new RegexResult(groups); } return RegexResult.EMPTY_RESULT; }
@Override public List<String> selectList(String text) { List<String> strings = new ArrayList<String>(); List<RegexResult> results = selectGroupList(text); for (RegexResult result : results) { strings.add(result.get(group)); } return strings; }
@Override public String select(String text) { return selectGroup(text).get(group); }
public List<RegexResult> selectGroupList(String text) { Matcher matcher = regex.matcher(text); List<RegexResult> resultList = new ArrayList<RegexResult>(); while (matcher.find()) { String[] groups = new String[matcher.groupCount() + 1]; for (int i = 0; i < groups.length; i++) { groups[i] = matcher.group(i); } resultList.add(new RegexResult(groups)); } return resultList; }
@Override public List<String> selectList(String text) { List<String> strings = new ArrayList<String>(); List<RegexResult> results = selectGroupList(text); for (RegexResult result : results) { strings.add(result.get(group)); } return strings; }
public RegexResult selectGroup(String text) { Matcher matcher = regex.matcher(text); if (matcher.find()) { String[] groups = new String[matcher.groupCount() + 1]; for (int i = 0; i < groups.length; i++) { groups[i] = matcher.group(i); } return new RegexResult(groups); } return RegexResult.EMPTY_RESULT; }
@Override public String select(String text) { return selectGroup(text).get(group); }
public List<RegexResult> selectGroupList(String text) { Matcher matcher = regex.matcher(text); List<RegexResult> resultList = new ArrayList<RegexResult>(); while (matcher.find()) { String[] groups = new String[matcher.groupCount() + 1]; for (int i = 0; i < groups.length; i++) { groups[i] = matcher.group(i); } resultList.add(new RegexResult(groups)); } return resultList; }