Variable in a QRegularExpression?
Moved
Unsolved
General and Desktop
-
Is it possible to construct a QRegularExpression that includes a variable? I'm not seeing any examples.
e.g.QString myVariable = "bar" QRegularExpression re ("^foo.* myVariable$")
-
Is it possible to construct a QRegularExpression that includes a variable? I'm not seeing any examples.
e.g.QString myVariable = "bar" QRegularExpression re ("^foo.* myVariable$")
@igor_stravinsky what about constructing the pattern before and using setPattern() method to apply it? pseudo-code:
QString myVariable = "bar"; QString myPattern = "^foo.*" + myVariable + "$"; QRegularExpression re; re.setPattern(myPattern);