[CMake] Greediness of kwsys regex
Gregor Jasny
gjasny at googlemail.com
Mon Nov 2 05:06:40 EST 2015
Hello,
Today I stumbled across funny behavior of string(REGEX REPLACE:
This one would lead to an empty match:
> string(REGEX REPLACE "(.*)" "\\1Proxy.cpp" _out "IConnectionCallback")
This one would match whole "IConnectionCallback"
> string(REGEX REPLACE "(.+)" "\\1Proxy.cpp" _out "IConnectionCallback")
Principle of least surprise makes me expect that both variants (* vs. +)
either contain the full string or the minimal set: empty for *, first
character for +.
Could someone please explain what's going on here?
Thanks,
Gregor
More information about the CMake
mailing list