From 074fc974ae75688421804e9e9af7b7b216b70c21 Mon Sep 17 00:00:00 2001 From: Angela Date: Mon, 14 Apr 2025 16:33:48 -0400 Subject: [PATCH 1/9] add regex info --- .../reference/collection-level-filtering.txt | 3 + .../filter-regex.txt | 57 +++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/source/reference/collection-level-filtering.txt b/source/reference/collection-level-filtering.txt index 89318749b..0d600b35a 100644 --- a/source/reference/collection-level-filtering.txt +++ b/source/reference/collection-level-filtering.txt @@ -85,6 +85,9 @@ Filters have the following syntax: } ] +To learn more about syntax for ``regex-pattern`` and options for regular +expression filtering, see :ref:`c2c-filter-regex`. + Filters must include either the ``database`` field or the ``databaseRegex`` field. If you need the filter to match specific collections, you can use either diff --git a/source/reference/collection-level-filtering/filter-regex.txt b/source/reference/collection-level-filtering/filter-regex.txt index eb0682707..06a230c24 100644 --- a/source/reference/collection-level-filtering/filter-regex.txt +++ b/source/reference/collection-level-filtering/filter-regex.txt @@ -36,6 +36,63 @@ you can use regular expressions: } } +The regular express pattern you pass into a filter must follow the :query:`regular +expression <$regex>` syntax supported by the MongoDB server. + +The following ``options`` are available for use with regular +expressions: + +.. list-table:: + :header-rows: 1 + :widths: 20 80 + + * - Option + - Description + + * - ``i`` + - Case insensitivity to match upper and lower cases. For an + example, see :ref:`regex-case-insensitive`. + + * - ``m`` + + - For patterns that include anchors (i.e. ``^`` for the start, + ``$`` for the end), match at the beginning or end of each + line for strings with multiline values. Without this option, + these anchors match at beginning or end of the string. For an + example, see :ref:`regex-multiline-match`. + + If the pattern contains no anchors or if the string value has + no newline characters (e.g. ``\n``), the ``m`` option has no + effect. + + * - ``x`` + + - "Extended" capability to ignore all white space characters in + the ``$regex`` pattern unless escaped or included in a + character class. + + Additionally, it ignores characters in-between and including + an un-escaped hash/pound (``#``) character and the next new + line, so that you may include comments in complicated + patterns. This only applies to data characters; white space + characters may never appear within special character + sequences in a pattern. + + The ``x`` option does not affect the handling of the VT + character (i.e. code 11). + + * - ``s`` + + - Allows the dot character (i.e. ``.``) to match all + characters *including* newline characters. For an example, + see :ref:`regex-dot-new-line`. + + * - ``u`` + + - Supports Unicode. This flag is accepted, but is redundant. UTF is set by + default in the ``$regex`` operator, making the ``u`` option + unnecessary. + Regular expressions in filter documents use the following fields: .. list-table:: From 664c146c551f11c79d502eb20678c142a5cbe107 Mon Sep 17 00:00:00 2001 From: Angela Date: Tue, 15 Apr 2025 10:16:19 -0400 Subject: [PATCH 2/9] change wording --- source/reference/collection-level-filtering.txt | 2 +- source/reference/collection-level-filtering/filter-regex.txt | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/source/reference/collection-level-filtering.txt b/source/reference/collection-level-filtering.txt index 0d600b35a..451c8b477 100644 --- a/source/reference/collection-level-filtering.txt +++ b/source/reference/collection-level-filtering.txt @@ -85,7 +85,7 @@ Filters have the following syntax: } ] -To learn more about syntax for ``regex-pattern`` and options for regular +To learn more about syntax for ``pattern`` and ``options`` for regular expression filtering, see :ref:`c2c-filter-regex`. Filters must include either the ``database`` field or the ``databaseRegex`` field. diff --git a/source/reference/collection-level-filtering/filter-regex.txt b/source/reference/collection-level-filtering/filter-regex.txt index 06a230c24..ac1dd5440 100644 --- a/source/reference/collection-level-filtering/filter-regex.txt +++ b/source/reference/collection-level-filtering/filter-regex.txt @@ -36,8 +36,7 @@ you can use regular expressions: } } -The regular express pattern you pass into a filter must follow the :query:`regular -expression <$regex>` syntax supported by the MongoDB server. +The regular express pattern you pass into a filter must follow the :query:`regex <$regex>` syntax supported by the MongoDB server. The following ``options`` are available for use with regular expressions: From e5e4ff0d2aaf4f277ca0af5ab78b8958cea567de Mon Sep 17 00:00:00 2001 From: Angela Date: Tue, 15 Apr 2025 10:16:48 -0400 Subject: [PATCH 3/9] expression --- source/reference/collection-level-filtering/filter-regex.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/reference/collection-level-filtering/filter-regex.txt b/source/reference/collection-level-filtering/filter-regex.txt index ac1dd5440..b5e71812c 100644 --- a/source/reference/collection-level-filtering/filter-regex.txt +++ b/source/reference/collection-level-filtering/filter-regex.txt @@ -36,7 +36,7 @@ you can use regular expressions: } } -The regular express pattern you pass into a filter must follow the :query:`regex <$regex>` syntax supported by the MongoDB server. +The regular expression pattern you pass into a filter must follow the :query:`regex <$regex>` syntax supported by the MongoDB server. The following ``options`` are available for use with regular expressions: From 7d365bae401c8756e3b9034e0a91bf5ff1fb7dff Mon Sep 17 00:00:00 2001 From: Angela Date: Tue, 15 Apr 2025 10:17:56 -0400 Subject: [PATCH 4/9] wording --- source/reference/collection-level-filtering/filter-regex.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/reference/collection-level-filtering/filter-regex.txt b/source/reference/collection-level-filtering/filter-regex.txt index b5e71812c..58182856d 100644 --- a/source/reference/collection-level-filtering/filter-regex.txt +++ b/source/reference/collection-level-filtering/filter-regex.txt @@ -38,8 +38,7 @@ you can use regular expressions: The regular expression pattern you pass into a filter must follow the :query:`regex <$regex>` syntax supported by the MongoDB server. -The following ``options`` are available for use with regular -expressions: +Regular expressions in filter documents use the following ``options``: .. list-table:: :header-rows: 1 From e7c596d705e86f72f0cd9855e74b686003af7178 Mon Sep 17 00:00:00 2001 From: Angela Date: Tue, 15 Apr 2025 13:42:14 -0400 Subject: [PATCH 5/9] jw feedback --- source/reference/collection-level-filtering.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/reference/collection-level-filtering.txt b/source/reference/collection-level-filtering.txt index 451c8b477..d494375b6 100644 --- a/source/reference/collection-level-filtering.txt +++ b/source/reference/collection-level-filtering.txt @@ -85,8 +85,7 @@ Filters have the following syntax: } ] -To learn more about syntax for ``pattern`` and ``options`` for regular -expression filtering, see :ref:`c2c-filter-regex`. +To learn more about the ``pattern`` and ``options`` regular expression syntax, see :ref:`c2c-filter-regex`. Filters must include either the ``database`` field or the ``databaseRegex`` field. From e957cae224df5a7b0fe06607f3550f745ce09a62 Mon Sep 17 00:00:00 2001 From: Angela Date: Wed, 16 Apr 2025 16:36:01 -0400 Subject: [PATCH 6/9] add information --- .../collection-level-filtering/filter-regex.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source/reference/collection-level-filtering/filter-regex.txt b/source/reference/collection-level-filtering/filter-regex.txt index 58182856d..d0c1e879e 100644 --- a/source/reference/collection-level-filtering/filter-regex.txt +++ b/source/reference/collection-level-filtering/filter-regex.txt @@ -38,7 +38,9 @@ you can use regular expressions: The regular expression pattern you pass into a filter must follow the :query:`regex <$regex>` syntax supported by the MongoDB server. -Regular expressions in filter documents use the following ``options``: +Regular expressions in filter documents use ``options`` listed in the :query:`regex +<$regex>` guide. ``options`` is a string of concatenated options. For example, to specify +the ``i`` and ``s`` options, pass in "si" to ``options``. .. list-table:: :header-rows: 1 @@ -141,8 +143,8 @@ creating a series of filters for individual databases or groups of collections. Details ======= -Regular Expression Options --------------------------- +Regular Expression Options Example +---------------------------------- ``databaseRegex`` and ``collectionsRegex`` each supports an ``options`` field, which you can use to configure regular expression options. @@ -151,7 +153,10 @@ Internally, ``mongosync`` passes the filter and options to the with Filtred Sync. For example, this filter would match collections in the ``sales`` database -that begin start with the ``accounts_`` string: +that begin with the ``accounts_`` string. The filter also specifies the option ``m`` to +match characters at the beginning or end of each line for strings with multiline values, and the +option ``s`` to allow the dot character to match all characters including newline +characters. .. code-block:: json From b0dae5b09c6853ba67b96187162444baeccc3fa1 Mon Sep 17 00:00:00 2001 From: Angela Date: Wed, 16 Apr 2025 16:38:30 -0400 Subject: [PATCH 7/9] add info --- source/reference/collection-level-filtering/filter-regex.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/reference/collection-level-filtering/filter-regex.txt b/source/reference/collection-level-filtering/filter-regex.txt index d0c1e879e..32c013a52 100644 --- a/source/reference/collection-level-filtering/filter-regex.txt +++ b/source/reference/collection-level-filtering/filter-regex.txt @@ -40,7 +40,8 @@ The regular expression pattern you pass into a filter must follow the :query:`re Regular expressions in filter documents use ``options`` listed in the :query:`regex <$regex>` guide. ``options`` is a string of concatenated options. For example, to specify -the ``i`` and ``s`` options, pass in "si" to ``options``. +the ``i`` and ``s`` options, pass in "si" to ``options``. The order of concatenated +options does not matter. .. list-table:: :header-rows: 1 From 5c92b08bec201fd9f01fb7c2718ed8da62e5aebc Mon Sep 17 00:00:00 2001 From: Angela Date: Wed, 16 Apr 2025 16:43:34 -0400 Subject: [PATCH 8/9] info --- source/reference/collection-level-filtering/filter-regex.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/reference/collection-level-filtering/filter-regex.txt b/source/reference/collection-level-filtering/filter-regex.txt index 32c013a52..94e6955fd 100644 --- a/source/reference/collection-level-filtering/filter-regex.txt +++ b/source/reference/collection-level-filtering/filter-regex.txt @@ -40,7 +40,7 @@ The regular expression pattern you pass into a filter must follow the :query:`re Regular expressions in filter documents use ``options`` listed in the :query:`regex <$regex>` guide. ``options`` is a string of concatenated options. For example, to specify -the ``i`` and ``s`` options, pass in "si" to ``options``. The order of concatenated +the ``i`` and ``s`` options, pass in ``"si"`` to ``options``. The order of concatenated options does not matter. .. list-table:: From d204bc9f6f3f64c17d234fb842ee175e8dabba29 Mon Sep 17 00:00:00 2001 From: Angela Date: Wed, 16 Apr 2025 16:53:19 -0400 Subject: [PATCH 9/9] remove options --- .../filter-regex.txt | 51 ------------------- 1 file changed, 51 deletions(-) diff --git a/source/reference/collection-level-filtering/filter-regex.txt b/source/reference/collection-level-filtering/filter-regex.txt index 94e6955fd..60f845f0e 100644 --- a/source/reference/collection-level-filtering/filter-regex.txt +++ b/source/reference/collection-level-filtering/filter-regex.txt @@ -43,57 +43,6 @@ Regular expressions in filter documents use ``options`` listed in the :query:`re the ``i`` and ``s`` options, pass in ``"si"`` to ``options``. The order of concatenated options does not matter. -.. list-table:: - :header-rows: 1 - :widths: 20 80 - - * - Option - - Description - - * - ``i`` - - Case insensitivity to match upper and lower cases. For an - example, see :ref:`regex-case-insensitive`. - - * - ``m`` - - - For patterns that include anchors (i.e. ``^`` for the start, - ``$`` for the end), match at the beginning or end of each - line for strings with multiline values. Without this option, - these anchors match at beginning or end of the string. For an - example, see :ref:`regex-multiline-match`. - - If the pattern contains no anchors or if the string value has - no newline characters (e.g. ``\n``), the ``m`` option has no - effect. - - * - ``x`` - - - "Extended" capability to ignore all white space characters in - the ``$regex`` pattern unless escaped or included in a - character class. - - Additionally, it ignores characters in-between and including - an un-escaped hash/pound (``#``) character and the next new - line, so that you may include comments in complicated - patterns. This only applies to data characters; white space - characters may never appear within special character - sequences in a pattern. - - The ``x`` option does not affect the handling of the VT - character (i.e. code 11). - - * - ``s`` - - - Allows the dot character (i.e. ``.``) to match all - characters *including* newline characters. For an example, - see :ref:`regex-dot-new-line`. - - * - ``u`` - - - Supports Unicode. This flag is accepted, but is redundant. UTF is set by - default in the ``$regex`` operator, making the ``u`` option - unnecessary. - Regular expressions in filter documents use the following fields: .. list-table::