summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorMartin Stadler <mail.martin.stadler@gmx.at>2024-04-11 09:16:32 (GMT)
committerBrad King <brad.king@kitware.com>2024-04-11 12:46:37 (GMT)
commitdc7a810a757749bcc24fbab446fb017ac4e65136 (patch)
tree5856c497d5b0993b3af017dcc0fbbe10ed4dc200 /Help
parentfcdc6e61734ccfaef10dbcfe0d05f05043603803 (diff)
downloadCMake-dc7a810a757749bcc24fbab446fb017ac4e65136.zip
CMake-dc7a810a757749bcc24fbab446fb017ac4e65136.tar.gz
CMake-dc7a810a757749bcc24fbab446fb017ac4e65136.tar.bz2
Help: Clarify documentation on regex character classes
In particular, give an example of matching `]`.
Diffstat (limited to 'Help')
-rw-r--r--Help/command/string.rst15
1 files changed, 8 insertions, 7 deletions
diff --git a/Help/command/string.rst b/Help/command/string.rst
index 2f01653..6bd56a1 100644
--- a/Help/command/string.rst
+++ b/Help/command/string.rst
@@ -136,15 +136,16 @@ The following characters have special meaning in regular expressions:
or ``\\`` for a literal backslash ``\``. Escaping a non-special
character is unnecessary but allowed, e.g. ``\a`` matches ``a``.
``[ ]``
- Matches any character(s) inside the brackets
+ Matches any character(s) inside the brackets.
+ To match a literal ``]``, make it the first character, e.g., ``[]ab]``.
``[^ ]``
- Matches any character(s) not inside the brackets
+ Matches any character(s) not inside the brackets.
+ To not match a literal ``]``, make it the first character, e.g., ``[^]ab]``.
``-``
- Inside brackets, specifies an inclusive range between
- characters on either side e.g. ``[a-f]`` is ``[abcdef]``
- To match a literal ``-`` using brackets, make it the first
- or the last character e.g. ``[+*/-]`` matches basic
- mathematical operators.
+ Inside brackets, specifies an inclusive range between characters on
+ either side, e.g., ``[a-f]`` is ``[abcdef]``.
+ To match a literal ``-`` using brackets, make it the first or the last
+ character, e.g., ``[+*/-]`` matches basic mathematical operators.
``*``
Matches preceding pattern zero or more times
``+``