[CMake] Capturing matches in regex groups

Robert Dailey rcdailey at gmail.com
Mon Nov 28 17:35:17 EST 2011


I haven't really seen a way to get a list of group matches in a regex. For
example, string( REGEX MATCH ) only returns the whole string matched, not
just what was in the capture groups. If I do this:

(\\w+)\\,(\\w+)\\,(\\w+)

and I match that regex against this string:

hello,world,today

I should get a list with:

hello;world;today

How can I do this?

---------
Robert Dailey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111128/e1ca1d37/attachment.htm>


More information about the CMake mailing list