Class: String

Inherits
Object
  • Object
show all
Defined in
lib/drumherum/regexp.rb

Instance Method Summary (collapse)

Instance Method Details

- (String) show_regexp(regular_expression)

Easy development of regular expressions.

Parameters:

  • regular_expression (Regexp)

    to match with self

Returns:

  • (String)

    result of the match



10
11
12
13
14
15
16
# File 'lib/drumherum/regexp.rb', line 10

def show_regexp(regular_expression)
    if self =~ regular_expression
        "#{$`}<<#{$&}>>#{$'}"
    else
        "no match"
    end # if
end