From efd2d43ae3cc29c500027a72241b6c6b833a01c6 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Mon, 28 Jul 2025 22:09:00 +0100 Subject: [PATCH] Update plugin name regex doc fancy-regex supports more syntax than C++ std::regex, but for the syntax that they both accept: - std::regex matches . against a single character, fancy-regex matches it against a Unicode codepoint - \w \W \d \D \s \S \b and \B are locale-dependent in std::regex but Unicode-aware and locale-independent in fancy-regex - case-insensitive comparisons are locale-dependent in std::regex but are Unicode-aware and locale-independent in fancy-regex - std::regex supports \0 and \cX escapes, where X is in [A-Za-z] but fancy-regex does not. This is not significant for libloot's usage as nul and control characters are not allowed in Windows filenames. - std::regex treats \< and \> as < and > respectively, but fancy-regex treats them as start- and end-of-word boundary assertions respectively. This is not significant for libloot's usage as they are not allowed in Windows filenames. - std::regex allows a literal [ to appear within a character class, but fancy-regex requires it to be escaped. These differences are unlikely to cause any issues. --- docs/metadata/data_structures/plugin.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/metadata/data_structures/plugin.rst b/docs/metadata/data_structures/plugin.rst index 188e826d..b2ff6200 100644 --- a/docs/metadata/data_structures/plugin.rst +++ b/docs/metadata/data_structures/plugin.rst @@ -9,7 +9,12 @@ This is the structure that brings all the others together, and forms the main co **Required.** Can be an exact plugin filename or a regular expression plugin filename. If the filename contains any of the characters ``:\*?|``, the string will be treated as a regular expression, otherwise it will be treated as an exact filename. For example, ``Example\.esm`` will be treated as a regular expression, as it contains a ``\`` character. - Regular expression plugin filenames must be written in `modified ECMAScript `_ syntax. + Regular expression plugin filenames must be written in a modified `ECMAScript `_ syntax. Notable differences include: + + - The ``\q{}`` `character class wrapper `_ is not supported. + - Most `v-mode character class escapes `_ are unnecessary: only ``[``, ``&&``, ``--`` and ``~~`` need to be escaped. + + Regular expression plugin filenames are prefixed with ``^`` and suffixed with ``$`` to ensure they match whole filenames, and are case-insensitive and Unicode-aware (as if they're created with the ``i`` and ``v`` flags). .. describe:: group