Skip to content

PythonQt.QtCore.QRegularExpressionMatchIterator

QRegularExpressionMatchIterator

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

A QRegularExpressionMatchIterator object is a forward only Java-like iterator; it can be obtained by calling the QRegularExpression::globalMatch() function. A new QRegularExpressionMatchIterator will be positioned before the first result. You can then call the hasNext() function to check if there are more results available; if so, the next() function will return the next result and advance the iterator.

Each result is a QRegularExpressionMatch object holding all the information for that result (including captured substrings).

For instance:

// extracts the words
QRegularExpression re("(\\w+)");
QString subject("the quick fox");
QRegularExpressionMatchIterator i = re.globalMatch(subject);
while (i.hasNext()) {
    QRegularExpressionMatch match = i.next();
    // ...
}

Moreover, QRegularExpressionMatchIterator offers a peekNext() function to get the next result without advancing the iterator.

You can retrieve the QRegularExpression object the subject string was matched against by calling the regularExpression() function; the match type and the match options are available as well by calling the matchType() and the matchOptions() respectively.

Please refer to the QRegularExpression documentation for more information about the Qt regular expression classes.

Source: https://doc.qt.io/archives/qt-5.15/qregularexpressionmatchiterator.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
hasNext function (self) -> bool X.hasNext() -> bool
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
isValid function (self) -> bool X.isValid() -> bool
matchOptions function (self) -> Any Returns the match options that were used to get this [QRegularExpressionMatchIterator](https://doc.qt.io/archives/qt-5.15/qregularexpressionmatchiterator.html) object, that is, the match options…
matchType function (self) -> Any Returns the match type that was used to get this [QRegularExpressionMatchIterator](https://doc.qt.io/archives/qt-5.15/qregularexpressionmatchiterator.html) object, that is, the match type that was…
next function (self) -> Any X.next() -> PythonQt.QtCore.QRegularExpressionMatch
operator_assign function (self, iterator: Any) -> Any X.operator_assign(iterator) -> PythonQt.QtCore.QRegularExpressionMatchIterator
peekNext function (self) -> Any X.peekNext() -> PythonQt.QtCore.QRegularExpressionMatch
regularExpression function (self) -> Any X.regularExpression() -> PythonQt.QtCore.QRegularExpression
swap function (self, other: Any) -> None Swaps the iterator other with this iterator object.