[Cmake] Capture regular expressions
Brad King
brad.king at kitware.com
Tue, 04 May 2004 08:38:48 -0400
Alexander Neundorf wrote:
> ...
>
>>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}")
No.
-Brad