[Cmake] Regex question

Dekeyser, Kris Kris.Dekeyser at lms.be
Fri Sep 3 06:03:45 EDT 2004


I cannot get a regular expression to work the way I want. I've read both the
on-line FAQ and the book, but I cannot figure out what I'm doing wrong.

I have the following string:
"\b\t\bSTL\t\b\t"

(\b stands for space, \t for tab)

When I'm parsing the string with:
STRING(REGEX REPLACE "^[ \t]*([A-Za-z_]*)[ \t]*$" "\\1" Dependency ${line})

CMake errors with:
CMake Error: Error in cmake code at
:0:
STRING sub-command REGEX, mode REPLACE regex "^[        ]*([A-Za-z_]*)[
]*$" matched an empty string.

and the Dependency variable is not set. Why? What am I doing wrong?

Parsing "\b\t\bpublic\t:\bSTL\b\t" with STRING(REGEX REPLACE "^[ \t]*public[
\t]*:[ \t]*([A-Za-z_]*)[ \t]*$" "\\1" Dependency ${line}) yields the correct
result, though.

- Kris

+-+-+- Email Confidentiality Footer +-+-+- 
Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this message (or responsible for delivery
of the message to such person), you may not print, retain, copy nor
disseminate this message or any part of it to anyone and you should notify
the sender by reply email and destroy this message. Neglecting this clause
could be a breach of confidence. Please advise immediately if you or your
employer does not consent to Internet email for messages of this kind.
Opinions, conclusions and other information in this message that are not
related to the official business of my firm shall be understood as neither
given nor endorsed by it.


More information about the Cmake mailing list