public class ARegularExpression extends java.lang.Object implements RegularExpression
Constructor and Description |
---|
ARegularExpression(UnicodeString pattern,
java.lang.String flags,
java.lang.String hostLanguage,
java.util.List<java.lang.String> warnings,
Configuration config)
Create and compile a regular expression
|
Modifier and Type | Method and Description |
---|---|
RegexIterator |
analyze(UnicodeString input)
Use this regular expression to analyze an input string, in support of the XSLT
analyze-string instruction.
|
static ARegularExpression |
compile(java.lang.String pattern,
java.lang.String flags)
Static factory method intended for simple static regular expressions known to be correct
|
static ARegularExpression |
compile(UnicodeString pattern,
java.lang.String flags)
Static factory method intended for simple static regular expressions known to be correct
|
boolean |
containsMatch(UnicodeString input)
Determine whether the regular expression contains a match of a given string
|
java.lang.String |
getFlags()
Get the flags used at the time the regular expression was compiled.
|
boolean |
matches(UnicodeString input)
Determine whether the regular expression matches a given string in its entirety
|
UnicodeString |
replace(UnicodeString input,
UnicodeString replacement)
Replace all substrings of a supplied input string that match the regular expression
with a replacement string.
|
UnicodeString |
replaceWith(UnicodeString input,
java.util.function.Function<UnicodeString,UnicodeString> replacer)
Replace all substrings of a supplied input string that match the regular expression
with a replacement string.
|
AtomicIterator |
tokenize(UnicodeString input)
Use this regular expression to tokenize an input string.
|
public ARegularExpression(UnicodeString pattern, java.lang.String flags, java.lang.String hostLanguage, java.util.List<java.lang.String> warnings, Configuration config) throws XPathException
pattern
- the regular expressionflags
- the flags (ixsmq)hostLanguage
- one of "XP20", "XP30", "XSD10", "XSD11". Also allow combinations, e.g. "XP20/XSD11".warnings
- a list to be populated with any warnings arising during compilation of the regexconfig
- the Saxon Configuration: may be nullXPathException
- if the regular expression is invalidpublic static ARegularExpression compile(java.lang.String pattern, java.lang.String flags)
pattern
- the regular expression, using XPath 3.1 syntaxflags
- regular expression flagsjava.lang.IllegalArgumentException
- if the regular expression or the flags are invalidpublic static ARegularExpression compile(UnicodeString pattern, java.lang.String flags)
public boolean matches(UnicodeString input)
matches
in interface RegularExpression
input
- the string to matchpublic boolean containsMatch(UnicodeString input)
containsMatch
in interface RegularExpression
input
- the string to matchpublic AtomicIterator tokenize(UnicodeString input)
tokenize
in interface RegularExpression
input
- the string to be tokenizedpublic RegexIterator analyze(UnicodeString input)
analyze
in interface RegularExpression
input
- the character string to be analyzed using the regular expressionpublic UnicodeString replace(UnicodeString input, UnicodeString replacement) throws XPathException
replace
in interface RegularExpression
input
- the input string on which replacements are to be performedreplacement
- the replacement string in the format of the XPath replace() functionXPathException
- if the replacement string is invalidpublic UnicodeString replaceWith(UnicodeString input, java.util.function.Function<UnicodeString,UnicodeString> replacer) throws XPathException
replaceWith
in interface RegularExpression
input
- the input string on which replacements are to be performedreplacer
- the replacement string in the format of the XPath replace() functionXPathException
- if the replacement string is invalidpublic java.lang.String getFlags()
getFlags
in interface RegularExpression
Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.