if (log.isDebugEnabled()) {
log.debug("Pattern = " + templatePattern.getPattern());
log.debug("template = " + rawTemplate);
}
int beginOffset = 0;
MatchResult currentResult;
PatternMatcherInput pinput = new PatternMatcherInput(rawTemplate);
while(matcher.contains(pinput, templatePattern)) {
currentResult = matcher.getMatch();
final int beginMatch = currentResult.beginOffset(0);
if (beginMatch > beginOffset) { // string is not empty
combined.add(rawTemplate.substring(beginOffset, beginMatch));
}
combined.add(Integer.valueOf(currentResult.group(1)));// add match as Integer
beginOffset = currentResult.endOffset(0);
}
if (beginOffset < rawTemplate.length()) { // trailing string is not empty
combined.add(rawTemplate.substring(beginOffset, rawTemplate.length()));
}