(PECL mongo >= 0.8.1)
MongoRegex::__construct — Creates a new regular expression
A extensão que define esse método está obsoleta. Alternativamente utilize a extensão MongoDB deve ser utilizada. Alternativas a esse método incluem:
$regex
)Creates a new regular expression.
regex
Regular expression string of the form /expr/flags.
Returns a new regular expression.
Exemplo #1 MongoRegex::__construct() example
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).
<?php
$luke_search = new MongoRegex("/^l[aeiouy]/i");
$cursor = $collection->find(array("username" => $luke_search));
?>