return;
}
List pieces = new ArrayList();
List combined = new LinkedList();
String rawTemplate = getTemplate();
PatternMatcher matcher = JMeterUtils.getMatcher();
Pattern templatePattern = JMeterUtils.getPatternCache().getPattern("\\$(\\d+)\\$" // $NON-NLS-1$
, Perl5Compiler.READ_ONLY_MASK
& Perl5Compiler.SINGLELINE_MASK);
log.debug("Pattern = " + templatePattern);
log.debug("template = " + rawTemplate);
Util.split(pieces, matcher, templatePattern, rawTemplate);
PatternMatcherInput input = new PatternMatcherInput(rawTemplate);
boolean startsWith = isFirstElementGroup(rawTemplate);
log.debug("template split into " + pieces.size() + " pieces, starts with = " + startsWith);
if (startsWith) {
pieces.remove(0);// Remove initial empty entry
}
Iterator iter = pieces.iterator();
while (iter.hasNext()) {
boolean matchExists = matcher.contains(input, templatePattern);
if (startsWith) {
if (matchExists) {
combined.add(new Integer(matcher.getMatch().group(1)));
}
combined.add(iter.next());
} else {
combined.add(iter.next());
if (matchExists) {
combined.add(new Integer(matcher.getMatch().group(1)));
}
}
}
if (matcher.contains(input, templatePattern)) {
log.debug("Template does end with template pattern");
combined.add(new Integer(matcher.getMatch().group(1)));
}
template = combined.toArray();
}