正则表达式的使用例子:

QString filename = "test";    
//检测是否是中文字符、大小写、数字或者“_”
QRegExp reg("^[\u4E00-\u9FA5A-Za-z0-9_]+$");    
if(!reg.exactMatch(filename))
{
    //文件名不匹配
}

正则表达式 – 教程 | 菜鸟教程 https://www.runoob.com/regexp/regexp-tutorial.html

正则表达式在线测试和常见正则表达式 | 菜鸟工具 https://c.runoob.com/front-end/854

 

 

 

posted on 2020-03-06 00:13  IT观察者  阅读(130)  评论(0编辑  收藏  举报