Results for: "match"

@return [Array] specs of default gems that are ‘==` to the given `spec`.

Compile a CaseMatchNode node

Compile a MatchRequiredNode node

Compile a MatchWriteNode node

Dispatch enter and leave events for CaseMatchNode nodes and continue walking the tree.

Dispatch enter and leave events for MatchRequiredNode nodes and continue walking the tree.

Dispatch enter and leave events for MatchWriteNode nodes and continue walking the tree.

Copy a CaseMatchNode node

Copy a MatchRequiredNode node

Copy a MatchWriteNode node

No documentation available

returns match status of CSI/SS3 sequence and matched length

Compile a MatchLastLineNode node

Dispatch enter and leave events for MatchLastLineNode nodes and continue walking the tree.

Copy a MatchLastLineNode node

Compile a InterpolatedMatchLastLineNode node

Dispatch enter and leave events for InterpolatedMatchLastLineNode nodes and continue walking the tree.

Copy a InterpolatedMatchLastLineNode node

MatchData encapsulates the result of matching a Regexp against string. It is returned by Regexp#match and String#match, and also stored in a global variable returned by Regexp.last_match.

Usage:

url = 'https://docs.ruby-lang.org/en/2.5.0/MatchData.html'
m = url.match(/(\d\.?)+/)   # => #<MatchData "2.5.0" 1:"0">
m.string                    # => "https://docs.ruby-lang.org/en/2.5.0/MatchData.html"
m.regexp                    # => /(\d\.?)+/
# entire matched substring:
m[0]                        # => "2.5.0"

# Working with unnamed captures
m = url.match(%r{([^/]+)/([^/]+)\.html$})
m.captures                  # => ["2.5.0", "MatchData"]
m[1]                        # => "2.5.0"
m.values_at(1, 2)           # => ["2.5.0", "MatchData"]

# Working with named captures
m = url.match(%r{(?<version>[^/]+)/(?<module>[^/]+)\.html$})
m.captures                  # => ["2.5.0", "MatchData"]
m.named_captures            # => {"version"=>"2.5.0", "module"=>"MatchData"}
m[:version]                 # => "2.5.0"
m.values_at(:version, :module)
                            # => ["2.5.0", "MatchData"]
# Numerical indexes are working, too
m[1]                        # => "2.5.0"
m.values_at(1, 2)           # => ["2.5.0", "MatchData"]

Global variables equivalence

Parts of last MatchData (returned by Regexp.last_match) are also aliased as global variables:

See also “Special global variables” section in Regexp documentation.

Represents the use of the modifier ‘in` operator.

foo in bar
^^^^^^^^^^

Represents a regular expression literal used in the predicate of a conditional to implicitly match against the last line read by an IO object.

if /foo/i then end
   ^^^^^^

Represents the use of the ‘=>` operator.

foo => bar
^^^^^^^^^^

Represents writing local variables using a regular expression match with named capture groups.

/(?<foo>bar)/ =~ baz
^^^^^^^^^^^^^^^^^^^^
No documentation available
No documentation available
Search took: 3ms  ·  Total Results: 2422