This repository was archived by the owner on May 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
DOCSP-37757-add-regex-info #731
Merged
shuangela
merged 9 commits into
mongodb:master
from
shuangela:DOCSP-37757-add-regex-info
Apr 24, 2025
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
074fc97
add regex info
shuangela 664c146
change wording
shuangela e5e4ff0
expression
shuangela 7d365ba
wording
shuangela e7c596d
jw feedback
shuangela e957cae
add information
shuangela b0dae5b
add info
shuangela 5c92b08
info
shuangela d204bc9
remove options
shuangela File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
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:: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
The :query:
regex <$regex>
section does link out to the server's own regex docs, but I can also remove the options section and also link out to the server regex docs as the options are the same as the server regex docs!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.
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.