Qt验证器正则表达式
Qt Validator Regular expression
我正在尝试验证QLineEdit中的条目,但我的语法有错误,因为当我运行程序时,它不允许我在编辑框中输入任何内容。条目需要是3个大写字母字符,后面跟着1,2或3,然后是另外两个数字,最后是一个字母或数字。
QRegExp StudentForm::modCodeFormat("(\s{3}\d[123]\d{2}\w{1})");
(\s{3}\d[123]\d{2}\w{1})
^ ^ ^ ^
This mat|ches wh|ite s|pace characters, not uppercase alphabetics
| | |
This match|es a |number then either a 1, 2 or a 3
| |
This mat|ches two numbers
|
This matches a single word characters, that is either a single number, uppercase, lowercase or an underscore _ character
相反,您应该使用:
^[A-Z]{3}[123][0-9]{2}[a-zA-Z0-9]$
相关文章:
- 使用正则表达式regex_search在字符串中查找字符串
- 在 C++ 中使用正则表达式错误时出现问题 括号表达式中的范围无效
- C++正则表达式无限循环
- FindPackageHandleStandardArgs.cmake:137 的 CMake 错误(消息):找不到 Boost (缺少:正则表达式)(找到合适的版本"1.72.0",
- 定义有趣的宏和正则表达式在Z3 C++绑定
- 带有多个字符分隔符的正则表达式
- C++ 使用增强正则表达式库时断言崩溃
- 有人可以帮助我处理正则表达式吗?
- 使用正则表达式获取大括号块的列表
- 正则表达式以匹配数字的重复模式,后跟任何类型的分隔符?
- 如何使HTML5电子邮件验证正则表达式在C++中工作?
- 如何编写将验证以下字符串的正则表达式?
- 解析 HTTP 的摘要式身份验证的正确正则表达式模式是什么?
- 使用c++正则表达式验证ASCII GnuPlot文件
- 混合分数的正则表达式验证 - Visual C++ 2012
- 正则表达式验证失败,而 egrep 验证正常
- 使用正则表达式进行输入验证
- Qt验证器正则表达式
- 使用正则表达式验证输入
- CPP +正则表达式验证URL