Creates a new regular expression

(PECL mongo >= 0.8.1)

MongoRegex::__constructCreates a new regular expression


public MongoRegex::__construct ( string $regex )

Creates a new regular expression.

Список параметров


Regular expression string of the form /expr/flags.

Возвращаемые значения

Returns a new regular expression.


Пример #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).

= new MongoRegex("/^l[aeiouy]/i");
$cursor $collection->find(array("username" => $luke_search));

Смотрите также