Class MatchData
In: lib/facet/matchdata/match_from.rb
lib/facet/matchdata/match.rb
Parent: Object

Methods

Public Instance methods

Return the primary match, equivalent to +md[0]+.

  require 'facet/matchdata/match'

  md = /123/.match "123456"
  md.match  #=> "123"

Returns the post_match from subexpression n.

  require 'facet/matchdate/match_from'

  md = /x(a)(b)(c)z/.match "123xabcz789"
  md.post_match_from(0)   #=> 789
  md.post_match_from(1)   #=> z789
  md.post_match_from(2)   #=> cz789
  md.post_match_from(3)   #=> bcz789
  md.post_match_from(-1)  #=> bcz789

Returns the pre_match from subexpression n.

  require 'facet/matchdate/match_from'

  md = /x(a)(b)(c)z/.match "123xabcz789"
  md.pre_match_from(0)   #=> 123
  md.pre_match_from(1)   #=> 123x
  md.pre_match_from(2)   #=> 123xa
  md.pre_match_from(3)   #=> 123xab
  md.pre_match_from(-1)  #=> 123xab

[Validate]