This question is an expanded question of this : How to replace QRegExp in a string?
In that question, problem is solved. But now I need to use QRegularExpression instead of QRegExp. How should I transfer the answer of Toby Speight?
This question is an expanded question of this : How to replace QRegExp in a string?
In that question, problem is solved. But now I need to use QRegularExpression instead of QRegExp. How should I transfer the answer of Toby Speight?
QRegExp
case insensitive search mode is enabled with Qt::CaseInsensitive
.
When you use QRegularExpression
that is based on PCRE regex engine, you may use QRegularExpression::CaseInsensitiveOption
:
The pattern should match against the subject string in a case insensitive way. This option corresponds to the
/i
modifier in Perl regular expressions.
In python, it's:
re = QRegularExpression(pattern, QRegularExpression.CaseInsensitiveOption | QRegularExpression.DotMatchesEverythingOption)
And if you need 2 options
re = QRegularExpression(pattern, QRegularExpression.CaseInsensitiveOption | QRegularExpression.DotMatchesEverythingOption)