Name
Regexp
Description
Holds a regular expression that is used to match a pattern against strings.
Class Methods
escape(string) => escaped_stringquote(string) => escaped_stringEscape regular expression metacharacters, so they aren’t interpreted when used inside a regular expression pattern.
last_match => matchdatalast_match(n) => stringReturn the
MatchDataof the last successful match, or thenth field in theMatchDataobject.Regexp.new(pattern [, options [, lang]]) => regexpRegexp.compile(pattern [, options [, lang]]) => regexpCreate a new
Regexpobject from a regular expression pattern. Options can be an OR’d combination ofRegexp::EXTENDED,Regexp::IGNORECASE, andRegexp::MULTILINE. Thelangparameter enables multibyte support for the regexp:'n','N'= none,'e','E'= EUC,'s','S'= SJIS,'u','U'= UTF-8.Regexp.union([pattern]*) => new_strCreate a
Regexpobject that is the union of given patterns joined by the alternation operator, where each pattern is either a pattern string, or aRegexpobject.
Instance Methods
regexp == second_regexp => booleanregexp.eql?(second_regexp) => booleanReturn true if two
Regexpobjects are based on identical patterns, and have the same character set code and mode options.match(string) => matchdata or nilReturn a
MatchDataobject describing the match, ornilif there was no match.casefold? => true or falseReturn true if
IGNORECASEis set for the entire pattern.inspect => stringReturn a string representation of the
Regexpobject.kcode => stringReturn ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access