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

search for in the

MongoRegex::__construct> <MongoDate::__toString
[edit] Last updated: Fri, 25 May 2012

view this page in

MongoRegex クラス

(バージョン情報なし。おそらく SVN 版にしか存在しないでしょう)

導入

このクラスを使うと正規表現を作ることができます。 典型的な使い道は、データベースへの問い合わせでマッチする文字列を検索することです。 それ以外に、正規表現をデータベースに格納したりデータベースから取得したりすることもできます。

Mongo は 6 つの正規表現フラグに対応しています。

  • i

    大文字小文字を区別しない

  • m

    複数行

  • x

    コメントを含めることができる

  • l

    ロケール

  • s

    "." が、改行を含むすべてにマッチする

  • u

    unicode にマッチする

クラス概要

MongoRegex {
/* フィールド */
public string $regex ;
public string $flags ;
/* メソッド */
public __construct ( string $regex )
public string __toString ( void )
}

目次



add a note add a note User Contributed Notes MongoRegex
benyounes dot ousama at gmail dot com 19-Nov-2010 09: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>";
 }
?>

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