Package net.sf.saxon.regex
Interface RegexIterator
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
,SequenceIterator
- All Known Implementing Classes:
ARegexIterator
,JRegexIterator
,ManualRegexIterator
public interface RegexIterator extends SequenceIterator
This interface defines an iterator that supports the evaluation of xsl:analyze-string. It returns all the matching and non-matching substrings in an input string, and provides access to their captured groups
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
RegexIterator.MatchHandler
Interface defining a call-back action for processing captured groups-
Nested classes/interfaces inherited from interface net.sf.saxon.om.SequenceIterator
SequenceIterator.Property
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getNumberOfGroups()
Get the number of captured groups in the current matching itemjava.lang.String
getRegexGroup(int number)
Get a substring that matches a parenthesised group within the regular expressionboolean
isMatching()
Determine whether the current item in the sequence is a matching item or a non-matching itemStringValue
next()
Get the next item in the sequence.void
processMatchingSubstring(RegexIterator.MatchHandler action)
Process a matching substring, performing specified actions at the start and end of each matching group-
Methods inherited from interface net.sf.saxon.om.SequenceIterator
close, forEachOrFail, getProperties, materialize
-
-
-
-
Method Detail
-
next
StringValue next() throws XPathException
Get the next item in the sequence. This method changes the state of the iterator.- Specified by:
next
in interfaceSequenceIterator
- Returns:
- the next item, or null if there are no more items. Once a call on next() has returned null, no further calls should be made. The preferred action for an iterator if subsequent calls on next() are made is to return null again, and all implementations within Saxon follow this rule.
- Throws:
XPathException
- if an error occurs retrieving the next item
-
isMatching
boolean isMatching()
Determine whether the current item in the sequence is a matching item or a non-matching item- Returns:
- true if the current item is a matching item
-
getNumberOfGroups
int getNumberOfGroups()
Get the number of captured groups in the current matching item
-
getRegexGroup
java.lang.String getRegexGroup(int number)
Get a substring that matches a parenthesised group within the regular expression- Parameters:
number
- the number of the group to be obtained- Returns:
- the substring of the current item that matches the n'th parenthesized group within the regular expression
-
processMatchingSubstring
void processMatchingSubstring(RegexIterator.MatchHandler action) throws XPathException
Process a matching substring, performing specified actions at the start and end of each matching group- Throws:
XPathException
-
-