@@ -36,6 +36,63 @@ you can use regular expressions:
36
36
}
37
37
}
38
38
39
+ The regular express pattern you pass into a filter must follow the :query:`regular
40
+ expression <$regex>` syntax supported by the MongoDB server.
41
+
42
+ The following ``options`` are available for use with regular
43
+ expressions:
44
+
45
+ .. list-table::
46
+ :header-rows: 1
47
+ :widths: 20 80
48
+
49
+ * - Option
50
+ - Description
51
+
52
+ * - ``i``
53
+ - Case insensitivity to match upper and lower cases. For an
54
+ example, see :ref:`regex-case-insensitive`.
55
+
56
+ * - ``m``
57
+
58
+ - For patterns that include anchors (i.e. ``^`` for the start,
59
+ ``$`` for the end), match at the beginning or end of each
60
+ line for strings with multiline values. Without this option,
61
+ these anchors match at beginning or end of the string. For an
62
+ example, see :ref:`regex-multiline-match`.
63
+
64
+ If the pattern contains no anchors or if the string value has
65
+ no newline characters (e.g. ``\n``), the ``m`` option has no
66
+ effect.
67
+
68
+ * - ``x``
69
+
70
+ - "Extended" capability to ignore all white space characters in
71
+ the ``$regex`` pattern unless escaped or included in a
72
+ character class.
73
+
74
+ Additionally, it ignores characters in-between and including
75
+ an un-escaped hash/pound (``#``) character and the next new
76
+ line, so that you may include comments in complicated
77
+ patterns. This only applies to data characters; white space
78
+ characters may never appear within special character
79
+ sequences in a pattern.
80
+
81
+ The ``x`` option does not affect the handling of the VT
82
+ character (i.e. code 11).
83
+
84
+ * - ``s``
85
+
86
+ - Allows the dot character (i.e. ``.``) to match all
87
+ characters *including* newline characters. For an example,
88
+ see :ref:`regex-dot-new-line`.
89
+
90
+ * - ``u``
91
+
92
+ - Supports Unicode. This flag is accepted, but is redundant. UTF is set by
93
+ default in the ``$regex`` operator, making the ``u`` option
94
+ unnecessary.
95
+
39
96
Regular expressions in filter documents use the following fields:
40
97
41
98
.. list-table::
0 commit comments