Closed AbitTheGray closed 4 years ago
From your pull request:
set(VERSION_REGEX "^AC_INIT\\(libconfig,[ \t]+([0-9\\.]+),.*")
The string ([0-9\\.]+)
will be translated to the regex ([0-9\.]+)
, which matches 0-9
, literal .
, but also \
.
.
don't need to be escaped inside character groups (e.g. [.]+
will match only literal dots). This is why the original string ([0-9\.]+)
was working as expected. CLion is right to complain that \.
will result in .
at the regex level.
Therefore, I think the escape character should be removed:
set(VERSION_REGEX "^AC_INIT\\(libconfig,[ \t]+([0-9.]+),.*")
I used cmake v3.10.2 to check.
OK, removed the backslash in new commit.
\.
does not escape.
on Regex Level but on string level. To escape.
on Regex level, you need to send\.
to Regex which is\\.
on string level (can be very confusing when you need to escape\
on Regex level resulting in\\\\
on string level).Did not notice this myself but CLion showed me this as an error.