6.0.0-rc4Source

QRegularExpressionMatchIterator Class

The QRegularExpressionMatchIterator class provides an iterator on the results of a global match of a QRegularExpression against a string. More…

Header#include <QRegularExpressionMatchIterator>
CMaketarget_link_libraries(app PRIVATE Nt::Core)
ModuleNt Core C++ Classes
Since5.0

List of all members, including inherited members

Public Functions

QRegularExpressionMatchIterator()
QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator &iterator)
QRegularExpressionMatchIterator(QRegularExpressionMatchIterator &&iterator)
~QRegularExpressionMatchIterator()
QRegularExpressionMatchIterator &operator=(const QRegularExpressionMatchIterator &iterator)
QRegularExpressionMatchIterator &operator=(QRegularExpressionMatchIterator &&iterator)
voidswap(QRegularExpressionMatchIterator &other)
boolisValid() const
boolhasNext() const
QRegularExpressionMatchnext()
QRegularExpressionMatchpeekNext() const
QRegularExpressionregularExpression() const
QRegularExpression::MatchTypematchType() const
QRegularExpression::MatchOptionsmatchOptions() const
RangeIteratorbegin() const
Sentinelend() const

Detailed Description

Call hasNext() and next() to walk over the matches, or iterate with a range-based for loop. After an empty match, the next search starts at the same position but must not be empty there; if that fails, it starts one character later.

See also QRegularExpression::globalMatch().

Differences from Qt

None.

Member Function Documentation

QRegularExpressionMatchIterator::QRegularExpressionMatchIterator()

Constructs an invalid iterator with no matches.

QRegularExpressionMatchIterator::QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator &iterator)

Constructs a copy of iterator. The copy advances independently.

QRegularExpressionMatchIterator::QRegularExpressionMatchIterator(QRegularExpressionMatchIterator &&iterator)

Move-constructs an iterator from iterator.

QRegularExpressionMatchIterator::~QRegularExpressionMatchIterator()

Destroys the iterator.

RangeIterator QRegularExpressionMatchIterator::begin() const

Returns an iterator to the first remaining match, for range-based for loops. Iterating does not advance this object.

Sentinel QRegularExpressionMatchIterator::end() const

Returns the sentinel that ends a range-based for loop.

bool QRegularExpressionMatchIterator::hasNext() const

Returns true if there is at least one more match; otherwise returns false.

See also next() and peekNext().

bool QRegularExpressionMatchIterator::isValid() const

Returns true if the iterator was produced by a valid regular expression; otherwise returns false.

QRegularExpression::MatchOptions QRegularExpressionMatchIterator::matchOptions() const

Returns the match options used by this iterator.

QRegularExpression::MatchType QRegularExpressionMatchIterator::matchType() const

Returns the match type used by this iterator.

QRegularExpressionMatch QRegularExpressionMatchIterator::next()

Returns the next match and advances the iterator. There must be a next match.

See also hasNext() and peekNext().

QRegularExpressionMatchIterator & QRegularExpressionMatchIterator::operator=(const QRegularExpressionMatchIterator &iterator)

Assigns iterator to this object and returns a reference to it.

QRegularExpressionMatchIterator & QRegularExpressionMatchIterator::operator=(QRegularExpressionMatchIterator &&iterator)

Move-assigns iterator to this object and returns a reference to it.

QRegularExpressionMatch QRegularExpressionMatchIterator::peekNext() const

Returns the next match without advancing the iterator. There must be a next match.

See also next().

QRegularExpression QRegularExpressionMatchIterator::regularExpression() const

Returns the regular expression that produced this iterator.

void QRegularExpressionMatchIterator::swap(QRegularExpressionMatchIterator &other)

Swaps this iterator with other.