public IMatchingResult buildMatcher(IEvaluatorContext eval) {
String subjectPat = this.getString();
List<InterpolationElement> resultRegExp = new LinkedList<InterpolationElement>();
if (subjectPat.charAt(0) != '/') {
throw new SyntaxError("Malformed Regular expression: "
+ subjectPat, this.getLocation());
}
int start = 1;
int end = subjectPat.length() - 1;
while (end > 0 && subjectPat.charAt(end) != '/') {
end--;
}
String modifiers = subjectPat.substring(end + 1);
if (subjectPat.charAt(end) != '/') {
throw new SyntaxError("Regular expression does not end with /",
this.getLocation());
}
if (modifiers.length() > 0) {
resultRegExp.add(new StaticInterpolationElement("(?" + modifiers + ")"));