QString pattern("李.*");
QRegExp rx(pattern);
bool match = rx.exactMatch("李明");
qDebug() << match;
// True
match = rx.exactMatch("北京");
qDebug() << match; //false
其中“.”表示任意字符,*表示任意个字符.
QString pattern("李.*");
QRegExp rx(pattern);
bool match = rx.exactMatch("李明");
qDebug() << match;
// True
match = rx.exactMatch("北京");
qDebug() << match; //false
其中“.”表示任意字符,*表示任意个字符.