Module Whois::ExtendedRegexp::InstanceMethods
In: lib/support/extended_regexp.rb

Extensions for Ruby’s core Regexp class.


Public Instance methods

Find and replace literal values in a regular expression source string. You pass it a Hash where the keys are either strings or regular expressions to search for, and their values are the replacement values. A completely new Regexp object is returned and options are preserved.

  /a __REPLACE___ day/i.interpolate("__REPLACE__" => "fun") => /a fun day/i

Inverted Regular Expressions

Gives the ability to invert a regular expression so that running a match against it will yield a true result when it does NOT match the target string.

Invert this regular expression.

Is this an inverted regular expression?

Run an inversion-aware match using this Regexp.

Make a copy of the current regular expression object but with new options. Options are given as a string, like so:

 /testing/i.new_options('im') => /testing/im

Uninvert this regular expression.