public class JRegexIterator extends java.lang.Object implements RegexIterator, LastPositionFinder
| Constructor and Description |
|---|
JRegexIterator(java.lang.String str,
java.util.regex.Pattern pattern)
Construct a RegexIterator.
|
| Modifier and Type | Method and Description |
|---|---|
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 JRegexIterator(java.lang.String str,
java.util.regex.Pattern pattern)
str - the string to be analysedpattern - 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
processMatchingSubstring in interface RegexIteratoraction - defines the processing to be performed at the start and end of a groupXPathExceptionCopyright (c) 2004-2022 Saxonica Limited. All rights reserved.