How does Qt use regular expressions to match a character

QTextCharFormat format;

QString text = “123 good of”;

QString patten = "\bgood\b";//represents the matched character is good \b represents the matching boundary, \b represents broad
QRegExp expression(patten);

int index = text.indexOf(expression);//If the attack is successful, it will return the matching position,
if it fails, it will return -1 if(index){ qDebug()<<matching success;

}

Guess you like

Origin blog.csdn.net/weixin_45825875/article/details/109526810