string — CMake 3.23.0-rc3 Documentation
cmake.org › cmake › helpSaves a matched subexpression, which can be referenced in the REGEX REPLACE operation. New in version 3.9: All regular expression-related commands, including e.g. if (MATCHES), save subgroup matches in the variables CMAKE_MATCH_<n> for <n> 0..9. *, + and ? have higher precedence than concatenation. | has lower precedence than concatenation.
CMAKE_MATCH_<n> — CMake 3.23.0-rc4 Documentation
cmake.org › cmake › helpNew in version 3.9. Capture group <n> matched by the last regular expression, for groups 0 through 9. Group 0 is the entire match. Groups 1 through 9 are the subexpressions captured by () syntax. When a regular expression match is used, CMake fills in CMAKE_MATCH_<n> variables with the match contents.
string
http://man.hubwiz.com › commandRegular Expressions string(REGEX MATCH <match-regex> <out-var> <input>. ... CMake 3.1 and below reported an error if length pointed past the end of string.
regex - CMAKE if regexp match - Stack Overflow
stackoverflow.com › questions › 71006140Feb 06, 2022 · 1 CMake does not support character classes in regular expressions; you need to use the character group with the same meaning. Furthermore I'm not sure why you add a capturing group that matches only a single string. if ($ {exename} MATCHES "^ (xxx) [A-Za-z0-9_]+") ... Note that this matches strings starting with xxx, not strings with xxx anywhere.
if — CMake 3.23.0-rc3 Documentation
cmake.org › cmake › helpOn non-Windows hosts, any path that begins with a tilde ( ~ ) evaluates to true. Comparisons ¶ if (<variable|string> MATCHES regex) True if the given string or variable's value matches the given regular expression. See Regex Specification for regex format. New in version 3.9: () groups are captured in CMAKE_MATCH_<n> variables.