Results for: "match"

Converts pattern to a Regexp (if it isn’t already one), then invokes its match method on str. If the second parameter is present, it specifies the position in the string to begin the search.

'hello'.match('(.)\1')      #=> #<MatchData "ll" 1:"l">
'hello'.match('(.)\1')[0]   #=> "ll"
'hello'.match(/(.)\1/)[0]   #=> "ll"
'hello'.match('xx')         #=> nil

If a block is given, invoke the block with MatchData if match succeed, so that you can write

str.match(pat) {|m| ...}

instead of

if m = str.match(pat)
  ...
end

The return value is a value from block execution in this case.

Returns a MatchData object describing the match, or nil if there was no match. This is equivalent to retrieving the value of the special variable $~ following a normal match. If the second parameter is present, it specifies the position in the string to begin the search.

/(.)(.)(.)/.match("abc")[2]   #=> "b"
/(.)(.)/.match("abc", 1)[2]   #=> "c"

If a block is given, invoke the block with MatchData if match succeed, so that you can write

/M(.*)/.match("Matz") do |m|
  puts m[0]
  puts m[1]
end

instead of

if m = /M(.*)/.match("Matz")
  puts m[0]
  puts m[1]
end

The return value is a value from block execution in this case.

Returns sym.to_s =~ obj.

The first form returns the MatchData object generated by the last successful pattern match. Equivalent to reading the special global variable $~ (see Special global variables in Regexp for details).

The second form returns the nth field in this MatchData object. n can be a string or symbol to reference a named capture.

Note that the last_match is local to the thread and method scope of the method that did the pattern match.

/c(.)t/ =~ 'cat'        #=> 0
Regexp.last_match       #=> #<MatchData "cat" 1:"a">
Regexp.last_match(0)    #=> "cat"
Regexp.last_match(1)    #=> "a"
Regexp.last_match(2)    #=> nil

/(?<lhs>\w+)\s*=\s*(?<rhs>\w+)/ =~ "var = val"
Regexp.last_match       #=> #<MatchData "var = val" lhs:"var" rhs:"val">
Regexp.last_match(:lhs) #=> "var"
Regexp.last_match(:rhs) #=> "val"

Return the pre-match

(in the regular expression sense) of the last scan.
s = StringScanner.new('test string')
s.scan(/\w+/)           # -> "test"
s.scan(/\s+/)           # -> " "
s.pre_match             # -> "test"
s.post_match            # -> "string"

Return the post-match

(in the regular expression sense) of the last scan.
s = StringScanner.new('test string')
s.scan(/\w+/)           # -> "test"
s.scan(/\s+/)           # -> " "
s.pre_match             # -> "test"
s.post_match            # -> "string"

Returns the portion of the original string before the current match. Equivalent to the special variable $`.

m = /(.)(.)(\d+)(\d)/.match("THX1138.")
m.pre_match   #=> "T"

Returns the portion of the original string after the current match. Equivalent to the special variable $'.

m = /(.)(.)(\d+)(\d)/.match("THX1138: The Movie")
m.post_match   #=> ": The Movie"

Matches addr against this entry.

Matches addr against each ACLEntry in this list.

Completion for hash key.

No documentation available
No documentation available
No documentation available

Returns an array of nodes matching a given XPath.

No documentation available

Matches this template against tuple. The tuple must be the same size as the template. An element with a nil value in a template acts as a wildcard, matching any value in the corresponding position in the tuple. Elements of the template match the tuple if the are == or ===.

Template.new([:foo, 5]).match   Tuple.new([:foo, 5]) # => true
Template.new([:foo, nil]).match Tuple.new([:foo, 5]) # => true
Template.new([String]).match    Tuple.new(['hello']) # => true

Template.new([:foo]).match      Tuple.new([:foo, 5]) # => false
Template.new([:foo, 6]).match   Tuple.new([:foo, 5]) # => false
Template.new([:foo, nil]).match Tuple.new([:foo])    # => false
Template.new([:foo, 6]).match   Tuple.new([:foo])    # => false

Matches this TemplateEntry against tuple. See Template#match for details on how a Template matches a Tuple.

No documentation available
No documentation available

Indicate if this NameTuple matches the current platform.

No documentation available
No documentation available

MatchData is the type of the special variable $~, and is the type of the object returned by Regexp#match and Regexp.last_match. It encapsulates all the results of a pattern match, results normally accessed through the special variables $&, $', $`, $1, $2, and so on.

The Matrix class represents a mathematical matrix. It provides methods for creating matrices, operating on them arithmetically and algebraically, and determining their mathematical properties (trace, rank, inverse, determinant).

Method Catalogue

To create a matrix:

To access Matrix elements/columns/rows/submatrices/properties:

Properties of a matrix:

Matrix arithmetic:

Matrix functions:

Matrix decompositions:

Complex arithmetic:

Conversion to other data types:

String representations:

Search took: 7ms  ·  Total Results: 2033