Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.

Commit e9b2180

Browse files
authored
DOCSP-37757-add-regex-info (#731)
* add regex info * change wording * expression * wording * jw feedback * add information * add info * info * remove options
1 parent fbec731 commit e9b2180

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

source/reference/collection-level-filtering.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ Filters have the following syntax:
8888
}
8989
]
9090

91+
To learn more about the ``pattern`` and ``options`` regular expression syntax, see :ref:`c2c-filter-regex`.
92+
9193
Filters must include either the ``database`` field or the ``databaseRegex`` field.
9294

9395
If you need the filter to match specific collections, you can use either

source/reference/collection-level-filtering/filter-regex.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ you can use regular expressions:
3939
}
4040
}
4141

42+
The regular expression pattern you pass into a filter must follow the :query:`regex <$regex>` syntax supported by the MongoDB server.
43+
44+
Regular expressions in filter documents use ``options`` listed in the :query:`regex
45+
<$regex>` guide. ``options`` is a string of concatenated options. For example, to specify
46+
the ``i`` and ``s`` options, pass in ``"si"`` to ``options``. The order of concatenated
47+
options does not matter.
48+
4249
Regular expressions in filter documents use the following fields:
4350

4451
.. list-table::
@@ -89,8 +96,8 @@ creating a series of filters for individual databases or groups of collections.
8996
Details
9097
=======
9198

92-
Regular Expression Options
93-
--------------------------
99+
Regular Expression Options Example
100+
----------------------------------
94101

95102
``databaseRegex`` and ``collectionsRegex`` each supports an ``options`` field,
96103
which you can use to configure regular expression options.
@@ -99,7 +106,10 @@ Internally, ``mongosync`` passes the filter and options to the
99106
with Filtred Sync.
100107

101108
For example, this filter would match collections in the ``sales`` database
102-
that begin start with the ``accounts_`` string:
109+
that begin with the ``accounts_`` string. The filter also specifies the option ``m`` to
110+
match characters at the beginning or end of each line for strings with multiline values, and the
111+
option ``s`` to allow the dot character to match all characters including newline
112+
characters.
103113

104114
.. code-block:: json
105115

0 commit comments

Comments
 (0)