Commit 19fac857 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'doc-regex-notes'

4b35dab8

 Help: Document how escape sequences work in a regex
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !2221
parents 11d71e6c 4b35dab8
Pipeline #109832 passed with stage
in 0 seconds
......@@ -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
^^^^^^^^^^^^
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment