downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

MongoRegex::__construct> <MongoDate::__toString
[edit] Last updated: Fri, 17 May 2013

view this page in

Clase MongoRegex

(PECL mongo >=0.8.1)

Introducción

Esta clase se puede usar para crear expresiones regulares. Normalmente, estas expresiones se usarán para consultar la base de datos y localizar textos que coincidan. Con menos frecuencia, se almacenarán en la base de datos para su posterior consulta.

Mongo reconoce seis banderas de expresiones regulares:

  • i

    Insensible a mayúsculas

  • m

    Multilínea

  • x

    Puede contener comentarios

  • l

    local

  • s

    "." coincidirá con todo, incluyendo cambios de línea

  • u

    unicode

Sinopsis de la Clase

MongoRegex {
/* Campos */
public string $regex ;
public string $flags ;
/* Métodos */
public __construct ( string $regex )
public string __toString ( void )
}

Tabla de contenidos



add a note add a note User Contributed Notes MongoRegex - [1 notes]
up
0
benyounes dot ousama at gmail dot com
2 years ago
First you must declare and define your regexObj
Here I am looking for all entry of my database wich is like "%Nicolas%" and the /i param is used for Insensitive Case
 $regexObj = new MongoRegex("/^Nicolas/i");

<?php
// I attach the regexObj to my Where Condition
 
$where = array("ctname" => $regexObj);

// Execute the request
 
$resultset = $this->db->Infos->find($where);

// Parsing the results
 
while ($resultset->hasNext())
 {
        
$clientObj = $resultset->getNext();
          echo
"Client Name: ".$clientObj["cname"]."</br>";
 }
?>

 
show source | credits | stats | sitemap | contact | advertising | mirror sites