diff --git a/reference/mongo/mongoregex.xml b/reference/mongo/mongoregex.xml
index a1cfda6b04..547d816cd2 100644
--- a/reference/mongo/mongoregex.xml
+++ b/reference/mongo/mongoregex.xml
@@ -17,55 +17,52 @@
More unusually, they can be saved to the database and retrieved.
- Mongo recognizes six regular expression flags:
+ Regular expressions consist of four parts. First a /
+ as starting delimiter, then then pattern, another /
+ and finally a string containing flags.
+
+
+
+ Regular expression pattern
+
+
+
+
+
+
+ MongoDB recognizes six regular expression flags:
- i
-
-
- Case insensitive
+ i: Case insensitive
- m
-
-
- Multiline
+ m: Multiline
- x
-
-
- Can contain comments
+ x: Can contain comments
- l
-
-
- locale
+ l: locale
- s
-
-
- dotall, "." matches everything, including newlines
+ s: dotall, "." matches everything, including newlines
- u
-
-
- match unicode
+ u: match unicode
diff --git a/reference/mongo/mongoregex/construct.xml b/reference/mongo/mongoregex/construct.xml
index 1ea5b5ce10..5f5efa04e3 100644
--- a/reference/mongo/mongoregex/construct.xml
+++ b/reference/mongo/mongoregex/construct.xml
@@ -28,7 +28,7 @@
- Regular expression string of the form /expr/flags.
+ Regular expression string of the form /expr/flags.
@@ -48,14 +48,15 @@
MongoRegex::__construct example
- This example uses a regular expression to query for all documents with a username field matching a regular expression.
+ This example uses a regular expression to query for all documents
+ with a username field starting (^) with an
+ l and a vowel ([aeiouy]),
+ case-insensitive (/i).
find(array("username" => $joe_search));
-
+$luke_search = new MongoRegex("/^l[aeiouy]/i");
+$cursor = $collection->find(array("username" => $luke_search));
?>
]]>