I'm trying to write the QRegExp
for extracting variable names from qmake project code (*.pro files).
The syntax of variable usage have two forms:
- $$VAR
- $${VAR}
So, my regular expression must handle both cases. I'm trying to write expression in this way:
\$\$\{?(\w+)\}?
But it does not work as expected: for string $$VAR
i've got $$V
match, with disabled "greeding" matching mode (QRegExp::setMinimal (true)
). As i understood, gready-mode can lead to wrong results in my case.
So, what am i doing wrong?
Or maybe i just should use greedy-mode and don't care about this behavior :)
P.S. Variable name can't contains spaces and other "special" symbols, only letters.