[CMake] regex ^ does not anchor against the original string
Brandon Van Every
bvanevery at gmail.com
Thu Nov 1 19:48:57 EDT 2007
^ doesn't anchor against the original input string. It anchors
against the string as it is processed! If replacements cause the
string to have a new beginning, it anchors against the new beginning.
I want to say that's a bug. Do other regex gurus agree, or have I
just not gone up the learning curve sufficiently?
SET(problem " else else else else else")
MESSAGE("original string:")
MESSAGE("${problem}")
MESSAGE("expecting replacement to have 4 else's. Instead we get:")
STRING(REGEX REPLACE
"^.else"
""
out "${problem}")
MESSAGE("${out}")
C:\devel\moz>cmake -P sideeffect.cmake
original string:
else else else else else
expecting replacement to have 4 else's. Instead we get:
C:\devel\moz>
Cheers,
Brandon Van Every
More information about the CMake
mailing list