[CMake] regex first subfolder

2011-12-26 Thread Anton Sibilev
Hello! Can you, please, help me with regex?

I have the string, for example, aaa111/bbb222/ccc333.
As the result of regex I want to get aaa111, but I can't set proper
expression..

string (REGEX REPLACE ^(.*/)?  folder ${folder}) ?
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] regex first subfolder

2011-12-26 Thread Michael Wild
On 12/26/2011 11:52 AM, Anton Sibilev wrote:
 Hello! Can you, please, help me with regex?
 
 I have the string, for example, aaa111/bbb222/ccc333.
 As the result of regex I want to get aaa111, but I can't set proper
 expression..
 
 string (REGEX REPLACE ^(.*/)?  folder ${folder}) ?
 

string(REGEX REPLACE ^(/?[^/]+).* \\1 folder ${folder})

Michael

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake