end(n) -> Integer | nil[permalink][rdoc][edit]- 
n 番目の部分文字列終端のオフセットを返します。
0 はマッチ全体を意味します。 n 番目の部分文字列がマッチしていなければ nil を返します。
- [PARAM] n:
 - 部分文字列を指定する数値。
 - [EXCEPTION] IndexError:
 - 範囲外の n を指定した場合に発生します。
 
例
/(foo)(bar)(BAZ)?/ =~ "foobarbaz" p $~.end(0) # => 6 p $~.end(1) # => 3 p $~.end(2) # => 6 p $~.end(3) # => nil p $~.end(4) # => `end': index 4 out of matches (IndexError)[SEE_ALSO] MatchData#begin