View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0011370 | CMake | CMake | public | 2010-10-27 08:06 | 2011-06-06 18:25 | ||||
Reporter | Dmitry Kuzmenko | ||||||||
Assigned To | David Cole | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | no change required | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake-2-8 | ||||||||
Target Version | Fixed in Version | CMake 2.8.4 | |||||||
Summary | 0011370: There is no way to specify ] in [ ] list in regular expressions | ||||||||
Description | I've tried to compile regular expression matches any string, ends with set of symbols, including right square bracket (']', '}' and ')', for example). I've found no way to do that simple thing. If I specify ".*[\]})]" cmake prints error: Syntax error in cmake code at /home/dimm/test/test.cmake:3 when parsing string .*[\]})] Invalid escape sequence \] If I use ".*[\\]})]" it thinks I want to match a string ends with "\})]" sequence. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0025271) David Cole (manager) 2011-02-03 19:34 |
This works for me: # Enclose everything except for ']' in the '[...]' sequence, and then # enclose that in an '(a|b)' construct, finally looking like: # "([...]|])" The following code: set(regex ".*([>}\\)]|])$") function(tryit s) if(s MATCHES "${regex}") message(STATUS " match: '${s}'") else() message(STATUS "NO match: '${s}'") endif() endfunction() tryit(" open [") tryit("close ]") tryit(" open {") tryit("close }") tryit(" open (") tryit("close )") tryit(" open <") tryit("close >") Yields this output: -- NO match: ' open [' -- match: 'close ]' -- NO match: ' open {' -- match: 'close }' -- NO match: ' open (' -- match: 'close )' -- NO match: ' open <' -- match: 'close >' |
(0025272) David Cole (manager) 2011-02-03 19:35 |
There is a way..... you just have to work out a different way than other regex engines many times. :-) See the previous note for a way to match ']' as a "part" of a [...] character set. |
(0026701) David Cole (manager) 2011-06-06 18:25 |
Closing resolved issues that have not been updated in more than 3 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2010-10-27 08:06 | Dmitry Kuzmenko | New Issue | |
2010-12-15 12:08 | David Cole | Assigned To | => David Cole |
2010-12-15 12:08 | David Cole | Status | new => assigned |
2011-02-03 19:34 | David Cole | Note Added: 0025271 | |
2011-02-03 19:35 | David Cole | Note Added: 0025272 | |
2011-02-03 19:35 | David Cole | Status | assigned => resolved |
2011-02-03 19:35 | David Cole | Fixed in Version | => CMake 2.8.4 |
2011-02-03 19:35 | David Cole | Resolution | open => no change required |
2011-06-06 18:25 | David Cole | Status | resolved => closed |
2011-06-06 18:25 | David Cole | Note Added: 0026701 |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |