org.exist.xquery.functions.text
Class RegexpFilter

java.lang.Object
  extended by org.exist.xquery.AbstractExpression
      extended by org.exist.xquery.PathExpr
          extended by org.exist.xquery.Function
              extended by org.exist.xquery.BasicFunction
                  extended by org.exist.xquery.functions.text.RegexpFilter
All Implemented Interfaces:
CompiledXQuery, Expression, RewritableExpression, org.xmldb.api.base.CompiledExpression

public class RegexpFilter
extends BasicFunction

xQuery function for filtering strings from text that match the specified pattern. E.g. AABBBBCBBC and BB.*BB results in BBBBCBB


Field Summary
protected static FunctionParameterSequenceType FLAGS_PARAM
           
protected static FunctionParameterSequenceType REGEX_PARAM
           
static FunctionSignature[] signatures
           
protected static FunctionParameterSequenceType TEXT_PARAM
           
 
Fields inherited from class org.exist.xquery.Function
BUILTIN_FUNCTION_NS, mySignature
 
Fields inherited from class org.exist.xquery.PathExpr
inPredicate, keepVirtual, LOG, staticContext, steps
 
Fields inherited from class org.exist.xquery.AbstractExpression
column, context, contextDocSet, contextId, line, unordered
 
Fields inherited from interface org.exist.xquery.Expression
DOT_TEST, EXPRESSION_ID_INVALID, IGNORE_CONTEXT, IN_NODE_CONSTRUCTOR, IN_PREDICATE, IN_UPDATE, IN_WHERE_CLAUSE, NEED_INDEX_INFO, NO_CONTEXT_ID, NON_STREAMABLE, POSITIONAL_PREDICATE, SINGLE_STEP_EXECUTION, UNORDERED, USE_TREE_TRAVERSAL
 
Constructor Summary
RegexpFilter(XQueryContext context, FunctionSignature signature)
          Creates a new instance of RegexpMatcher
 
Method Summary
 Sequence eval(Sequence[] args, Sequence contextSequence)
          Process the function.
 Sequence filter(Sequence[] args)
           
 Sequence groups(Sequence[] args)
           
protected static int parseFlags(java.lang.String s)
           
protected  java.lang.String translateRegexp(java.lang.String pattern)
          Translates the regular expression from XPath2 syntax to java regex syntax.
 
Methods inherited from class org.exist.xquery.BasicFunction
eval
 
Methods inherited from class org.exist.xquery.Function
accept, analyze, checkArgument, checkArguments, createFunction, dump, getArgument, getArgumentCount, getArguments, getCardinality, getDependencies, getName, getParent, getParentModule, getSignature, isCalledAs, returnsType, setArguments, setParent, setPrimaryAxis, simplify, toString
 
Methods inherited from class org.exist.xquery.PathExpr
add, add, addPath, addPredicate, allowMixNodesInReturn, dump, getColumn, getContext, getDocumentSet, getExpression, getLastExpression, getLength, getLine, getLiteralValue, getPrimaryAxis, getSubExpression, getSubExpressionCount, isValid, replaceExpression, replaceLastExpression, reset, resetState, setContext, setUseStaticContext
 
Methods inherited from class org.exist.xquery.AbstractExpression
eval, getContextDocSet, getContextId, getExpressionId, getSource, match, needsReset, setASTNode, setContextDocSet, setContextId, setLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.exist.xquery.CompiledXQuery
eval, getSource
 

Field Detail

FLAGS_PARAM

protected static final FunctionParameterSequenceType FLAGS_PARAM

REGEX_PARAM

protected static final FunctionParameterSequenceType REGEX_PARAM

TEXT_PARAM

protected static final FunctionParameterSequenceType TEXT_PARAM

signatures

public static final FunctionSignature[] signatures
Constructor Detail

RegexpFilter

public RegexpFilter(XQueryContext context,
                    FunctionSignature signature)
Creates a new instance of RegexpMatcher

Method Detail

eval

public Sequence eval(Sequence[] args,
                     Sequence contextSequence)
              throws XPathException
Description copied from class: BasicFunction
Process the function. All arguments are passed in the array args. The number of arguments, their type and cardinality have already been checked to match the function signature.

Specified by:
eval in class BasicFunction
Throws:
XPathException

filter

public Sequence filter(Sequence[] args)
                throws XPathException
Throws:
XPathException

groups

public Sequence groups(Sequence[] args)
                throws XPathException
Throws:
XPathException

translateRegexp

protected java.lang.String translateRegexp(java.lang.String pattern)
                                    throws XPathException
Translates the regular expression from XPath2 syntax to java regex syntax.

Parameters:
pattern - XPath regexp expression
Returns:
Java regexp expression
Throws:
XPathException

parseFlags

protected static final int parseFlags(java.lang.String s)
                               throws XPathException
Throws:
XPathException