getArgument(2).eval(docs, contextSequence, contextItem).getStringValue();
getArgument(2).eval(contextSequence, contextItem).getStringValue();
	public Sequence eval(DocumentSet docs, Sequence contextSequence, Item contextItem)		throws XPathException {		Sequence stringArg = getArgument(0).eval(docs, contextSequence, contextItem);		if (stringArg.getLength() == 0)			return Sequence.EMPTY_SEQUENCE;		String string = stringArg.getStringValue();		String pattern =			getArgument(1).eval(docs, contextSequence, contextItem).getStringValue();		String replace =			getArgument(2).eval(docs, contextSequence, contextItem).getStringValue();		int flags = 0;		if (getArgumentCount() == 4)			flags =				parseFlags(					getArgument(3)						.eval(docs, contextSequence, contextItem)						.getStringValue());		try {			if (prevPattern == null				|| (!pattern.equals(prevPattern))				|| flags != prevFlags)				pat = compiler.compile(pattern, flags);			prevPattern = pattern;			prevFlags = flags;			String r =				Util.substitute(					matcher,					pat,					new Perl5Substitution(replace),					string,					Util.SUBSTITUTE_ALL);			return new StringValue(r);		} catch (MalformedPatternException e) {			throw new XPathException("Invalid regular expression: " + e.getMessage(), e);		}	}