[Cmake] Capture regular expressions
Alexander Neundorf
a.neundorf-work at gmx.net
Tue, 4 May 2004 08:03:51 +0200 (MEST)
...
> What do you mean by "version around parentheses"? Code like this is
> supported:
>
> STRING(REGEX REPLACE "#define[\\t\\ ]+QT_VERSION_STR[\\t\\
> ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" "\\1" qt_version "${VERSION_STR}")
>
> Note the "\\1" in the replace expression. The two backslashes make it
> through argument processing as a single backslash, and then the "\1" is
> replaced by the part of the string matched inside the parentheses.
>
> -Brad
Are multiple groups also supported, so that I can capture different matching
groups
into different variables ?
Something like:
STRING(REGEX REPLACE "#define[\\t\\ ]+QT_VERSION_STR[\\t\\
> ]+\"([0-9]+)\\.([0-9]+)\\.([0-9]+)\"" "\\1" "\\2" "\\3" qt_major_version
qt_minor_version qt_pachtlevel "${VERSION_STR}")
Bye
Alex
--
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info