On 07/15/2011 10:10 AM, Sven Klomp wrote: > Hi, > > I'm using cmake 2.8.3 and have a problem using regular expressions: > > STRING(REGEX REPLACE > "^(Input:[0-9]+:)([^/].*)$" > "_Start_\\1_Middle_\\2_End_" > TESTVARIABLE > "Input:1:filename1 \nInput:104:filename2 \n" > ) > MESSAGE("${TESTVARIABLE}") > > The expected output is: > _Start_Input:1:_Middle_filename1_End_ > _Start_Input:104:_Middle_filename2_End_ > > However, the actual output is: > _Start_Input:1:_Middle_filename1 > Input:104:filename2 > _End_ > > It seems that . matches also the newline, altough > http://www.cmake.org/cmake/help/syntax.html > says ist shouldn't!
Obviously, that's not true: STRING(REGEX REPLACE "." "X" VAR "\n") MESSAGE("VAR: ${VAR}") yields: VAR: X > How can I get the expected result? STRING(REGEX REPLACE "(Input:[0-9]+:)([^/][^\n]*)" "_Start_\\1_Middle_\\2_End_" TESTVARIABLE "Input:1:filename1 \nInput:104:filename2 \n" ) Regards, 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