Class BSON::Regex
In: lib/bson/types/regex.rb
Parent: Object

generates a wrapped Regexp with lazy compilation. can represent flags not supported in Ruby‘s core Regexp class before compilation.

Methods

==   eql?   from_native   initialize_copy   inspect   new   try_compile  

Constants

IGNORECASE = 0x01
LOCALE_DEPENDENT = 0x02
MULTILINE = 0x04
DOTALL = 0x08
UNICODE = 0x10
EXTENDED = 0x20

External Aliases

pattern -> source

Attributes

options  [RW] 
pattern  [RW] 

Public Class methods

Attempt to convert a native Ruby Regexp to a BSON::Regex.

@note Warning: Ruby regular expressions use a different syntax and different

  set of flags than BSON regular expressions. A regular expression matches different
  strings when executed in Ruby than it matches when used in a MongoDB query,
  if it can be used in a query at all.

@param regexp [Regexp] The native Ruby regexp object to convert to BSON::Regex.

@return [BSON::Regex]

Create a new regexp.

@param pattern [String] @param opts [Array, String]

Public Instance methods

==(regexp)

Alias for eql?

Check equality of this wrapped Regexp with another.

@param [BSON::Regex] regexp

Clone or dup the current BSON::Regex.

Get a human-readable representation of this BSON Regex.

Compile the BSON::Regex.

@note Warning: regular expressions retrieved from the server may include a pattern

  that cannot be compiled into a Ruby regular expression, or which matches a
  different set of strings in Ruby than it does when used in a MongoDB query,
  or it may have flags that are not supported by Ruby regular expressions.

@return [Regexp] A ruby core Regexp object.

[Validate]