Notes |
|
(0025271)
|
David Cole
|
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
|
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
|
2011-06-06 18:25
|
|
Closing resolved issues that have not been updated in more than 3 months. |
|