Skip to content

Commit 721aa32

Browse files
authored
RexEx inconsistencies (#7022)
* re-add expression * removing unexpected file changes * update docs to agree on the supported regex options * remove duplicate info and point to more detailed page * wordsmithing; remote info box
1 parent ac3f4e8 commit 721aa32

File tree

2 files changed

+10
-19
lines changed

2 files changed

+10
-19
lines changed

source/reference/mongodb-extended-json.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -585,15 +585,9 @@ Where the values are as follows:
585585

586586
- ``"<options>"``
587587

588-
- A string that specifies BSON regular expression options ('g', 'i',
589-
'm' and 's') or an empty string ``""``.
590-
591-
- Options other than ('g', 'i', 'm' and 's') will be dropped when
592-
converting to this representation.
593-
594-
.. important::
595-
596-
The options MUST be in alphabetical order.
588+
- A string that specifies BSON regular expression options. You must specify
589+
the options in alphabetical order. For information on the supported options,
590+
see :query:`$options`.
597591

598592
.. bsontype:: Timestamp
599593

source/reference/operator/query/regex.txt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,14 @@ expression.
8787

8888
.. list-table::
8989
:header-rows: 1
90-
:widths: 10 60 30
90+
:widths: 20 80
9191

9292
* - Option
9393
- Description
94-
- Syntax Restrictions
9594

9695
* - ``i``
9796
- Case insensitivity to match upper and lower cases. For an
9897
example, see :ref:`regex-case-insensitive`.
99-
-
10098

10199
* - ``m``
102100

@@ -110,8 +108,6 @@ expression.
110108
no newline characters (e.g. ``\n``), the ``m`` option has no
111109
effect.
112110

113-
-
114-
115111
* - ``x``
116112

117113
- "Extended" capability to ignore all white space characters in
@@ -128,20 +124,21 @@ expression.
128124
The ``x`` option does not affect the handling of the VT
129125
character (i.e. code 11).
130126

131-
- Requires ``$regex`` with ``$options`` syntax
132-
133127
* - ``s``
134128

135129
- Allows the dot character (i.e. ``.``) to match all
136130
characters *including* newline characters. For an example,
137131
see :ref:`regex-dot-new-line`.
138132

139-
- Requires ``$regex`` with ``$options`` syntax
133+
* - ``u``
134+
135+
- Supports Unicode. This flag is accepted, but is redundant. UTF is set by
136+
default in the ``$regex`` operator, making the ``u`` option
137+
unnecessary.
140138

141139
.. note::
142140

143-
The ``$regex`` operator does not support the global search
144-
modifier ``g``.
141+
The ``$regex`` operator *does not* support the global search modifier ``g``.
145142

146143
Behavior
147144
--------

0 commit comments

Comments
 (0)