The MongoRegex class

Introduction

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.

Regular expressions consist of four parts. First a /
as starting delimiter, then the pattern, another /
and finally a string containing flags.

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");