QT字符串汉字匹配

QString pattern("李.*");
QRegExp rx(pattern);

bool match = rx.exactMatch("李明");
qDebug() << match;  
                    // True

match = rx.exactMatch("北京");
qDebug() << match;       //false

 其中“.”表示任意字符,*表示任意个字符. 

你可能感兴趣的:(QT字符串汉字匹配)