介绍QString使用正则操作的接口。
Qt 5.0引入QRegularExpression,相比于QRegExp,前者修复了很多bugs,功能上也是兼容于QRegExp。推荐使用QRegularExpression。
bool contains(const QRegExp &rx) constbool contains(QRegExp &rx) constbool contains(const QRegularExpression &re) constbool contains(const QRegularExpression &re, QRegularExpressionMatch *match) const
int count(const QRegExp &rx) constint count(const QRegularExpression &re) const
int indexOf(QRegExp &rx, int from = 0) constint indexOf(const QRegularExpression &re, int from = 0) constint indexOf(const QRegularExpression &re, int from, QRegularExpressionMatch *rmatch) const
int lastIndexOf(QRegExp &rx, int from = -1) constint lastIndexOf(const QRegularExpression &re, int from = -1) constint lastIndexOf(const QRegularExpression &re, int from, QRegularExpressionMatch *rmatch) const
QString &remove(const QRegExp &rx)QString &remove(const QRegularExpression &re)
QString &replace(const QRegExp &rx, const QString &after)QString &replace(const QRegularExpression &re, const QString &after)
QString section(const QRegExp ®, int start, int end = -1, QString::SectionFlags flags = SectionDefault) constQString section(const QRegularExpression &re, int start, int end = -1, QString::SectionFlags flags = SectionDefault) const
QStringList split(const QRegExp &rx, QString::SplitBehavior behavior = KeepEmptyParts) constQStringList split(const QRegularExpression &re, QString::SplitBehavior behavior = KeepEmptyParts) const
QVector<QStringRef> splitRef(const QRegExp &rx, QString::SplitBehavior behavior = KeepEmptyParts) constQVector<QStringRef> splitRef(const QRegularExpression &re, QString::SplitBehavior behavior = KeepEmptyParts) const