summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-07-18 15:09:56 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-07-18 15:10:02 (GMT)
commit19fac8572a97e20376dea8d81fae594378cf0975 (patch)
tree6277c8c13c2dc431452c8184ccd34c9e400df6fc
parent11d71e6cd0eedae224eca52d4f8bc6cb6baf46d8 (diff)
parent4b35dab8916b9c88336a776eaaadd8e6746a50b6 (diff)
downloadCMake-19fac8572a97e20376dea8d81fae594378cf0975.zip
CMake-19fac8572a97e20376dea8d81fae594378cf0975.tar.gz
CMake-19fac8572a97e20376dea8d81fae594378cf0975.tar.bz2
Merge topic 'doc-regex-notes'
4b35dab891 Help: Document how escape sequences work in a regex Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2221
-rw-r--r--Help/command/string.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/Help/command/string.rst b/Help/command/string.rst
index efa923b..29a153a 100644
--- a/Help/command/string.rst
+++ b/Help/command/string.rst
@@ -151,6 +151,20 @@ has lower precedence than concatenation. This means that the regular
expression ``^ab+d$`` matches ``abbd`` but not ``ababd``, and the regular
expression ``^(ab|cd)$`` matches ``ab`` but not ``abd``.
+Backslash (``\``) characters in regular expressions are interpreted
+literally and do not escape anything or represent placeholders.
+However, CMake language :ref:`Escape Sequences` such as ``\t``,
+``\r``, ``\n``, and ``\\`` may be used to construct literal tabs,
+carriage returns, newlines, and backslashes (respectively) to pass
+in a regex. For example:
+
+* The quoted argument ``"[ \t\r\n]"`` specifies a regex that matches
+ any single whitespace character.
+* The quoted argument ``"[/\\]"`` specifies a regex that matches
+ a single forward slash ``/`` or backslash ``\``.
+* The quoted argument ``"[A-Za-z0-9_]"`` specifies a regex that matches
+ any single "word" character in the C locale.
+
Manipulation
^^^^^^^^^^^^