downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

MongoRegex::__toString> <MongoRegex
[edit] Last updated: Fri, 30 Dec 2011

view this page in

MongoRegex::__construct

(PECL mongo >= 0.8.1)

MongoRegex::__constructCreates a new regular expression

Description

MongoRegex::__construct ( string $regex )

Creates a new regular expression.

Parameters

regex

Regular expression string of the form /expr/flags.

Return Values

Returns a new regular expression.

Examples

Example #1 MongoRegex::__construct() example

This example uses a regular expression to query for all documents with a username field matching a regular expression.

<?php

$joe_search 
= new MongoRegex("/j[o0]e/i");
$cursor $collection->find(array("username" => $joe_search));

?>

See Also



add a note add a note User Contributed Notes MongoRegex::__construct
There are no user contributed notes for this page.

 
show source | credits | sitemap | contact | advertising | mirror sites