GoLang MongoRegex::__construct

request it (83)
GoLang replacement for PHP's MongoRegex::__construct [edit | history]



Do you know a GoLang replacement for PHP's MongoRegex::__construct? Write it!

PHP MongoRegex::__construct

PHP original manual for MongoRegex::__construct [ show | php.net ]

MongoRegex::__construct

(PECL mongo >= 0.8.1)

MongoRegex::__constructCreates a new regular expression

Description

public MongoRegex::__construct ( string $regex )

Creates a new regular expression.

Parameters

regex

Regular expression string of the form /expr/flags.

Return Values

Returns a new regular expression.

Examples

Example #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));
?>

See Also