QRegularExpression Qlineedit 验证

QRegularExpression Lineedit Validatoin

你好,我正在尝试使用 qt 中的正则表达式验证来自 lineedit 小部件的数据(由 2 个或更多单词的名称组成),问题是 qt 允许 lineedit 小部件中的任何内容,我的代码如下,谢谢。

QRegularExpression Company_Name("/([A-Z|a-z|0-9])/g");
QRegularExpressionMatch Company_Name_Match = Company_Name.match(ui->lineEdit_Company_Name->text())
if(Company_Name_Match.hasMatch())
{
    ErrorLog = ErrorLog + "Company Name contains charagters that are not alphanumeric\n";
    ui->lineEdit_Company_Name->setStyleSheet("border: 1px solid red");

谢谢

i'm trying to validate the data (consisting of names of 2 or more words)

^[a-zA-Z0-9]+(\s[a-zA-Z0-9]+)+$