PHP Doku:: The MongoRegex class - class.mongoregex.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatenbankerweiterungenAnbieterspezifische DatenbankerweiterungenMongoDB Native DriverTypesThe MongoRegex class

Ein Service von Reinhard Neidl - Webprogrammierung.

Types

<<MongoDate::__toString

MongoRegex::__construct>>


UnterSeiten:

The MongoRegex class

Einführung

This class can be used to create regular expressions. Typically, these expressions will be used to query the database and find matching strings. More unusually, they can be saved to the database and retrieved.

Mongo recognizes six regular expression flags:

  • i

    Case insensitive

  • m

    Multiline

  • x

    Can contain comments

  • l

    locale

  • s

    dotall, "." matches everything, including newlines

  • u

    match unicode

Klassenbeschreibung

MongoRegex {
/* Fields */
public string $regex ;
public string $flags ;
/* Methoden */
__construct ( string $regex )
public string __toString ( void )
}

Inhaltsverzeichnis


Ein BenutzerBeitrag:
- Beiträge aktualisieren...
benyounes dot ousama at gmail dot com
19.11.2010 18:49
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>";
 }
?>



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)