QRegularExpression ::PatternOptions options = re. | QRegularExpression ::DotMatchesEverythingOption) QRegularExpression re = QRegularExpression( "^two.*words$", QRegularExpression ::MultilineOption You can set the pattern string by passing a string to the QRegularExpression constructor: A regular expression is made up of two things: a pattern string and a set of pattern options that change the meaning of the pattern string. For an overview of the regular expression syntax supported by QRegularExpression, please refer to the aforementioned pcrepattern(3) man page. QRegularExpression implements Perl-compatible regular expressions.