svn: /phpdoc/en/trunk/reference/mongo/ mongoregex/construct.xml mongoregex.xml

From: Date: Fri, 24 May 2013 22:18:15 +0000
Subject: svn: /phpdoc/en/trunk/reference/mongo/ mongoregex/construct.xml mongoregex.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-11352@lists.php.net to get a copy of this message
derick Fri, 24 May 2013 22:18:15 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=330350 Log: Documentation for Regular Expressions (PHP-834) Changed paths: U phpdoc/en/trunk/reference/mongo/mongoregex/construct.xml U phpdoc/en/trunk/reference/mongo/mongoregex.xml Modified: phpdoc/en/trunk/reference/mongo/mongoregex/construct.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/mongoregex/construct.xml 2013-05-24 21:34:07 UTC (rev 330349) +++ phpdoc/en/trunk/reference/mongo/mongoregex/construct.xml 2013-05-24 22:18:15 UTC (rev 330350) @@ -28,7 +28,7 @@ </term> <listitem> <para> - Regular expression string of the form /expr/flags. + Regular expression string of the form <literal>/expr/flags</literal>. </para> </listitem> </varlistentry> @@ -48,14 +48,15 @@ <para> <example> <title><function>MongoRegex::__construct</function> example</title> - <para>This example uses a regular expression to query for all documents with a username field matching a regular expression.</para> + <para>This example uses a regular expression to query for all documents + with a username field starting (<literal>^</literal>) with an + <literal>l</literal> and a vowel (<literal>[aeiouy]</literal>), + case-insensitive (<literal>/i</literal>).</para> <programlisting role="php"> <![CDATA[ <?php - -$joe_search = new MongoRegex("/j[o0]e/i"); -$cursor = $collection->find(array("username" => $joe_search)); - +$luke_search = new MongoRegex("/^l[aeiouy]/i"); +$cursor = $collection->find(array("username" => $luke_search)); ?> ]]> </programlisting> Modified: phpdoc/en/trunk/reference/mongo/mongoregex.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/mongoregex.xml 2013-05-24 21:34:07 UTC (rev 330349) +++ phpdoc/en/trunk/reference/mongo/mongoregex.xml 2013-05-24 22:18:15 UTC (rev 330350) @@ -17,56 +17,53 @@ More unusually, they can be saved to the database and retrieved. </para> <para> - Mongo recognizes six regular expression flags: + Regular expressions consist of four parts. First a <literal>/</literal> + as starting delimiter, then then pattern, another <literal>/</literal> + and finally a string containing flags. </para> + <para> + <example> + <title>Regular expression pattern</title> + <screen> +<![CDATA[ +/pattern/flags +]]> + </screen> + </example> + </para> + <para> + MongoDB recognizes six regular expression flags: + </para> <itemizedlist> <listitem> <para> - <literal>i</literal> + <literal>i</literal>: Case insensitive </para> - <para> - Case insensitive - </para> </listitem> <listitem> <para> - <literal>m</literal> + <literal>m</literal>: Multiline </para> - <para> - Multiline - </para> </listitem> <listitem> <para> - <literal>x</literal> + <literal>x</literal>: Can contain comments </para> - <para> - Can contain comments - </para> </listitem> <listitem> <para> - <literal>l</literal> + <literal>l</literal>: locale </para> - <para> - locale - </para> </listitem> <listitem> <para> - <literal>s</literal> + <literal>s</literal>: dotall, "." matches everything, including newlines </para> - <para> - dotall, "." matches everything, including newlines - </para> </listitem> <listitem> <para> - <literal>u</literal> + <literal>u</literal>: match unicode </para> - <para> - match unicode - </para> </listitem> </itemizedlist> </section>

« previous php.doc.cvs (#11352) next »