[cmake-developers] [CMake 0013792]: REGEX REPLACE fails if () capture is empty

Mantis Bug Tracker mantis at public.kitware.com
Thu Dec 13 16:26:18 EST 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13792 
====================================================================== 
Reported By:                mwoehlke
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13792
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-12-13 16:26 EST
Last Modified:              2012-12-13 16:26 EST
====================================================================== 
Summary:                    REGEX REPLACE fails if () capture is empty
Description: 
string(REGEX REPLACE) fails for certain patterns with 'matched an empty string'
error if a capture grood is empty, even if the full match is non-empty.

Steps to Reproduce: 
set(input foo)
string(REGEX REPLACE "^([^.]*)(\\..*)?$" "\\1" output ${input})

Additional Information: 
CMake is correctly matching the regular expression (as can be seen by examining
the captures), and the overall pattern (which is the old text to be replaced) is
non-empty, so there should be no problem. (Even more interestingly, while the
above pattern triggers the problem, other patterns which one might expect to
tickle the same glitch do not.)
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-12-13 16:26 mwoehlke       New Issue                                    
======================================================================




More information about the cmake-developers mailing list