public class ARegexIterator extends java.lang.Object implements RegexIterator, LastPositionFinder
| Constructor and Description |
|---|
ARegexIterator(UnicodeString str,
UnicodeString regex,
REMatcher matcher)
Construct a RegexIterator.
|
| Modifier and Type | Method and Description |
|---|---|
static IntToIntHashMap |
computeNestingTable(UnicodeString regex)
Compute a table showing for each captured group number (opening paren in the regex),
the number of its parent group.
|
int |
getLength()
Get the last position (that is, the number of items in the sequence).
|
int |
getNumberOfGroups()
Get the number of captured groups
|
UnicodeString |
getRegexGroup(int number)
Get a substring that matches a parenthesised group within the regular expression
|
boolean |
isMatching()
Determine whether the current item is a matching item or a non-matching item
|
StringValue |
next()
Get the next item in the sequence
|
void |
processMatchingSubstring(RegexMatchHandler action)
Process a matching substring, performing specified actions at the start and end of each captured
subgroup.
|
boolean |
supportsGetLength()
Ask whether this iterator supports use of the
LastPositionFinder.getLength() method. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, dischargepublic ARegexIterator(UnicodeString str, UnicodeString regex, REMatcher matcher)
str - the string to be analysedmatcher - a matcher for the regular expressionpublic boolean supportsGetLength()
LastPositionFinderLastPositionFinder.getLength() method. This
method should always be called before calling LastPositionFinder.getLength(), because an iterator
that implements this interface may support use of LastPositionFinder.getLength() in some situations
and not in otherssupportsGetLength in interface LastPositionFinderLastPositionFinder.getLength() method can be called to determine the length
of the underlying sequence.public int getLength()
LastPositionFinderLastPositionFinder.supportsGetLength() has been called
and has returned true.getLength in interface LastPositionFinderpublic StringValue next()
next in interface SequenceIteratornext in interface RegexIteratorpublic boolean isMatching()
isMatching in interface RegexIteratorpublic UnicodeString getRegexGroup(int number)
getRegexGroup in interface RegexIteratornumber - the number of the group to be obtainedpublic int getNumberOfGroups()
getNumberOfGroups in interface RegexIteratorpublic void processMatchingSubstring(RegexMatchHandler action) throws XPathException
RegexMatchHandler methods onGroupStart() and onGroupEnd().processMatchingSubstring in interface RegexIteratoraction - defines the processing to be performed at the start and end of a groupXPathExceptionpublic static IntToIntHashMap computeNestingTable(UnicodeString regex)
Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.