MongoRegex::__construct

(PECL mongo >= 0.8.1)

MongoRegex::__constructCreates a new regular expression

Opis

public MongoRegex::__construct ( string $regex )

Creates a new regular expression.

Parametry

regex

Regular expression string of the form /expr/flags.

Zwracane wartości

Returns a new regular expression.

Przykłady

Przykład #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));
?>

Zobacz też:

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top