The following issue has been SUBMITTED. ====================================================================== http://www.cmake.org/Bug/view.php?id=14336 ====================================================================== Reported By: irwin Assigned To: ====================================================================== Project: CMake Issue ID: 14336 Category: CMake Reproducibility: always Severity: minor Priority: normal Status: new ====================================================================== Date Submitted: 2013-08-03 02:18 EDT Last Modified: 2013-08-03 02:18 EDT ====================================================================== Summary: REGEX REPLACE does not give correct results for a left anchor (^) combined with careted brackets Description: # Test code to show the issue. set(filename "whatever") string(REGEX REPLACE "(^[e])" "/\\1" CATALOG_filename "${filename}") message(STATUS "filename=${filename}") message(STATUS "CATALOG_filename=${CATALOG_filename}") string(REGEX REPLACE "(^[^e])" "/\\1" CATALOG_filename "${filename}") message(STATUS "filename=${filename}") message(STATUS "CATALOG_filename=${CATALOG_filename}")
The first REGEX REPLACE gives a correct result (no match because of the anchor so no replacement is done) while the second REGEX REPLACE produces an incorrect result (anchor ignored until the "e" is hit in whatever). Steps to Reproduce: Run the above code using cmake -P. The results are -- filename=whatever -- CATALOG_filename=whatever -- filename=whatever -- CATALOG_filename=/w/h/a/tever That last one should be -- CATALOG_filename=/whatever because the anchor should limit the match to just the first character (so long as that first character is not an "e" as in this case) so the "/" should be prepended only to the first character. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2013-08-03 02:18 irwin New Issue ====================================================================== -- 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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
