MongoRegex
MongoRegex::__toString
MongoRegex
PHP Manual

# MongoRegex::__construct

(PECL mongo >= 0.8.1)

MongoRegex::__construct — Creates a new regular expression

### Descripción

MongoRegex::__construct ( string `$regex` )

Creates a new regular expression.

### Lista de parámetros

`regex`

  Regular expression string of the form /expr/flags.

### Valores retornados

Returns a new regular expression.

### Ejemplos

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));
?>`

### Ver también

- MongoRegex::__toString - A string representation of this regular expression

MongoRegex
MongoRegex::__toString
MongoRegex
PHP Manual