summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/string/RegexMultiMatchClear.cmake
blob: 788ba5edd318d6e8a3d5b81e5aa53bfc6c91efe3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function (output_results msg)
  message("results from: ${msg}")
  message("CMAKE_MATCH_0: -->${CMAKE_MATCH_0}<--")
  message("CMAKE_MATCH_1: -->${CMAKE_MATCH_1}<--")
  message("CMAKE_MATCH_2: -->${CMAKE_MATCH_2}<--")
  message("CMAKE_MATCH_COUNT: -->${CMAKE_MATCH_COUNT}<--")
endfunction ()

set(haystack "Some::Scope")

string(REGEX MATCHALL "^([^:]+)(::)?" matches "${haystack}")
message("matches: ${matches}")
output_results("string(REGEX MATCHALL)")

string(REGEX REPLACE "^([^:]+)(::)?" "[\\1]" replace "${haystack}")
message("replace: ${replace}")
output_results("string(REGEX REPLACE)")