View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0013790 | CMake | CMake | public | 2012-12-13 13:48 | 2016-06-10 14:31 | ||||
Reporter | mwoehlke | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake 2.8.9 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0013790: regex replace does not allow anchored empty matches | ||||||||
Description | string(REGEX REPLACE) fails with error 'string sub-command REGEX, mode REPLACE regex <pattern> matched an empty string.' when the regular expression is anchored. Since the position of the match is non-ambiguous when an anchor is present, the replace should succeed, even if the substring being replaced is empty. (Other tools, e.g. sed, are able to do this.) | ||||||||
Steps To Reproduce | set(FOO foo) string(REGEX REPLACE "$" "_suffix" BAR "${FOO}") (Expected result: BAR contains "foo_suffix") | ||||||||
Additional Information | The above example is contrived for the sake of simplification. An actual use case might be replacing an existing prefix/suffix that matches a regular expression and may or may not be present. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0031878) David Cole (manager) 2012-12-13 13:56 |
An easy workaround, if you would like one before this bug gets fixed, is to match the whole string and append the suffix: string(REGEX REPLACE "^(.*)$" "\\1_suffix" BAR "${FOO}") |
(0042170) Kitware Robot (administrator) 2016-06-10 14:28 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2012-12-13 13:48 | mwoehlke | New Issue | |
2012-12-13 13:56 | David Cole | Note Added: 0031878 | |
2016-06-10 14:28 | Kitware Robot | Note Added: 0042170 | |
2016-06-10 14:28 | Kitware Robot | Status | new => resolved |
2016-06-10 14:28 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:28 | Kitware Robot | Assigned To | => Kitware Robot |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |