-
Notifications
You must be signed in to change notification settings - Fork 39
DOCSP-37757-add-regex-info #731
Changes from 4 commits
074fc97
664c146
e5e4ff0
7d365ba
e7c596d
e957cae
b0dae5b
5c92b08
d204bc9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,61 @@ 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we just link to the server’s own regexp docs? That seems better than duplicating the information here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The :query: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To address your overarching comment about adding an example, there is an example on the filter-regex page of matching with multiple regex options, but I tried to make the lead in text clearer for it and added a better title to make that more clear. |
||
|
||
Regular expressions in filter documents use the following ``options``: | ||
|
||
|
||
.. 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:: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[optional / suggestion] (brevity)
Optional edit to trim this sentence by a couple of words