Skip to content

Commit 812cf2a

Browse files
author
Sam Kleinman
committed
minor clarification about regular expressions
1 parent 4ad55b0 commit 812cf2a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

source/reference/operator/regex.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ $regex
77
.. operator:: $regex
88

99
The :operator:`$regex` operator provides regular expression
10-
capabilities in queries. MongoDB uses Perl compatible regular
11-
expressions (i.e. "PCRE."))The following examples are equivalent:
10+
capabilities for pattern matching *strings* in queries. MongoDB uses Perl compatible regular
11+
expressions (i.e. "PCRE.")
12+
13+
You can specify regular expressions using regular expression
14+
objects or using the :operator:`$regex` operator. The following
15+
examples are equivalent:
1216

1317
.. code-block:: javascript
1418

@@ -53,13 +57,13 @@ $regex
5357
- ``s`` allows the dot (e.g. ``.``) character to match all
5458
characters *including* newline characters.
5559

56-
:operator:`$regex` only provides the ``i`` and ``m`` options in the
57-
short JavaScript syntax (i.e. ``/acme.*corp/i``). To use ``x``
60+
:operator:`$regex` only provides the ``i`` and ``m`` options for
61+
the native JavaScript regular expression objects (e.g. ``/acme.*corp/i``). To use ``x``
5862
and ``s`` you must use the ":operator:`$regex`" operator with the
5963
":operator:`$options`" syntax.
6064

6165
To combine a regular expression match with other operators, you
62-
need to specify the ":operator:`$regex`" operator. For example:
66+
need to use the ":operator:`$regex`" operator. For example:
6367

6468
.. code-block:: javascript
6569

0 commit comments

Comments
 (0)