* Simplify and validate.
* This is a pure function so it can be simplified in advance if the arguments are known
*/
public Expression simplify(StaticContext env) throws XPathException {
Expression e = simplifyArguments(env);
// compile the regular expression once if possible
if (!(e instanceof Value)) {
regexp = Matches.tryToCompile(argument, 1, 2);
// check that it's not a pattern that matches ""