net.sf.saxon.dotnet
Class DotNetRegularExpression
java.lang.Object
net.sf.saxon.dotnet.DotNetRegularExpression
- RegularExpression, Serializable
public class DotNetRegularExpression
extends java.lang.Object
A compiled regular expression implemented using the .NET regex package
DotNetRegularExpression(CharSequence regex, int xmlVersion, int syntax, CharSequence flags) - Create (compile) a regular expression
|
RegexIterator | analyze(CharSequence input) - Use this regular expression to analyze an input string, in support of the XSLT
analyze-string instruction.
|
boolean | containsMatch(CharSequence input) - Determine whether the regular expression contains a match of a given string
|
static boolean | isCaseBlind(CharSequence inFlags) - Test whether the 'i' flag is set.
|
static boolean | isIgnoreWhitespace(CharSequence inFlags) - Test whether the 'x' flag is set.
|
boolean | matches(CharSequence input) - Determine whether the regular expression matches a given string
|
CharSequence | replace(CharSequence input, CharSequence replacement) - Replace all substrings of a supplied input string that match the regular expression
with a replacement string.
|
static RegexOptions | setFlags(CharSequence inFlags) - Set the Java flags from the supplied XPath flags.
|
SequenceIterator | tokenize(CharSequence input) - Use this regular expression to tokenize an input string.
|
DotNetRegularExpression
public DotNetRegularExpression(CharSequence regex,
int xmlVersion,
int syntax,
CharSequence flags)
throws XPathException
Create (compile) a regular expression
regex
- the source text of the regular expression, in XML Schema or XPath syntaxxmlVersion
- indicates whether XML 1.0 or XML 1.1 is in usesyntax
- indicates whether this is an XPath regular expression, an XML Schema regular expression,
or a regex in .NET native regex syntaxflags
- the flags argument as supplied to functions such as fn:matches(), in string form
XPathException
- if the syntax of the regular expression or flags is incorrect
analyze
public RegexIterator analyze(CharSequence input)
Use this regular expression to analyze an input string, in support of the XSLT
analyze-string instruction. The resulting RegexIterator provides both the matching and
non-matching substrings, and allows them to be distinguished. It also provides access
to matched subgroups.
- analyze in interface RegularExpression
containsMatch
public boolean containsMatch(CharSequence input)
Determine whether the regular expression contains a match of a given string
- containsMatch in interface RegularExpression
input
- the string to match
- true if the string matches, false otherwise
isCaseBlind
public static boolean isCaseBlind(CharSequence inFlags)
Test whether the 'i' flag is set.
inFlags
- the flags as a string, e.g. "im"
- true if the 'i' flag is set
isIgnoreWhitespace
public static boolean isIgnoreWhitespace(CharSequence inFlags)
Test whether the 'x' flag is set.
inFlags
- the flags as a string, e.g. "im"
- true if the 'x' flag is set
matches
public boolean matches(CharSequence input)
Determine whether the regular expression matches a given string
- matches in interface RegularExpression
input
- the string to match
- true if the string matches, false otherwise
replace
public CharSequence replace(CharSequence input,
CharSequence replacement)
throws XPathException
Replace all substrings of a supplied input string that match the regular expression
with a replacement string.
- 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() function
- the result of performing the replacement
setFlags
public static RegexOptions setFlags(CharSequence inFlags)
throws XPathException
Set the Java flags from the supplied XPath flags.
inFlags
- the flags as a string, e.g. "im"
- the flags as a RegexOptions FlagsAttribute
tokenize
public SequenceIterator tokenize(CharSequence input)
Use this regular expression to tokenize an input string.
- tokenize in interface RegularExpression
input
- the string to be tokenized
- a SequenceIterator containing the resulting tokens, as objects of type StringValue