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

Commit 20a5f39

Browse files
committed
DOCSP-37757-add-regex-info (#731)
* add regex info * change wording * expression * wording * jw feedback * add information * add info * info * remove options (cherry picked from commit e9b2180)
1 parent 8f8fb88 commit 20a5f39

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
@@ -85,6 +85,8 @@ Filters have the following syntax:
8585
}
8686
]
8787

88+
To learn more about the ``pattern`` and ``options`` regular expression syntax, see :ref:`c2c-filter-regex`.
89+
8890
Filters must include either the ``database`` field or the ``databaseRegex`` field.
8991

9092
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
@@ -36,6 +36,13 @@ you can use regular expressions:
3636
}
3737
}
3838

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

4148
.. list-table::
@@ -86,8 +93,8 @@ creating a series of filters for individual databases or groups of collections.
8693
Details
8794
=======
8895

89-
Regular Expression Options
90-
--------------------------
96+
Regular Expression Options Example
97+
----------------------------------
9198

9299
``databaseRegex`` and ``collectionsRegex`` each supports an ``options`` field,
93100
which you can use to configure regular expression options.
@@ -96,7 +103,10 @@ Internally, ``mongosync`` passes the filter and options to the
96103
with Filtred Sync.
97104

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

101111
.. code-block:: json
102112

0 commit comments

Comments
 (0)