prev - up - next - index

Regexp

The Regexp is the class for regular expression matching. Regular expression literals are enclosed by slashes like:

/^this is regexp/

In other way, you can create the regular expression object using:

Regexp.new(string)

SuperClass:

Object

Class Methods:

compile(string[, casefold])
new(string[, options])

Compiles the string into a regular expression object. If second argument given, and its value is true, then the created regexp object becomes case-insensitive. the value of the second argument is Fixnum, it must be bitwise-or of Regexp::IGNORECASE and Regexp::EXTENDED.

quote(string)

Insert escape characters before regular expression special characters in the string. Returns the newly created strings.

Methods:

self =~ string
self === string

Returns an index of the matching place in the string, if matched. Returns nil if not matched. The index of the first character is 0.

~ self

Matches with the value of the default variable ($_). Behaves like:

self =~ $_
casefold?

Returns true if the Regexp is compiled as case-insensitive.

source

Returns the orginal string form of the regular expression.


prev - up - next - index

[email protected]