![5277f2fb14c7db4158bb1acd17d81b5e.png](https://img-blog.csdnimg.cn/img_convert/5277f2fb14c7db4158bb1acd17d81b5e.png)
介绍QString使用正则操作的接口。
Qt 5.0引入QRegularExpression,相比于QRegExp,前者修复了很多bugs,功能上也是兼容于QRegExp。推荐使用QRegularExpression。
contains
- 正则表达式rx是否与字符串中的某个地方匹配,匹配返回true,否则返回false。
bool contains(const QRegExp &rx) const
bool contains(QRegExp &rx) const
bool contains(const QRegularExpression &re) const
bool contains(const QRegularExpression &re, QRegularExpressionMatch *match) const
count
- 返回正则表达式rx在字符串中匹配的次数。
int count(const QRegExp &rx) const
int count(const QRegularExpression &re) const