PHP Portal » PHP Handbuch » MongoRegex::__construct

Werbung

MongoRegex::__construct


(PECL mongo >= 0.8.1)

MongoRegex::__constructCreates a new regular expression

Beschreibung

MongoRegex::__construct ( string $regex )

Creates a new regular expression.

Parameter-Liste

regex

Regular expression string of the form /expr/flags.

Rückgabewerte

Returns a new regular expression.

Beispiele

Beispiel #1 MongoRegex::__construct() example

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

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

Siehe auch