From: Robert Klemme Date: 2004-09-24T04:44:32+09:00 Subject: Re: Matchdata#end one character after match? "trans. (T. Onoma)" schrieb im Newsbeitrag news:200409231333.49887.transami@runbox.com... >I know this is probably just the way it works, but I was a bit antiPOLSed. > > irb(main):016:0> md = /X/.match("yzXrb") > => # > irb(main):018:0> p md.begin(0) > 2 > => nil > irb(main):017:0> p md.end(0) > 3 > => nil > > 3 and not 2? Yes, and it's reasonable: all sorts of computations are a lot easier with this convention. For example: length = m.end(0) - m.begin(0) empty = m.begin(0) == m.end(0) etc. All libs that deal with sub sequences reasonable do it this way. *I* would have been surprised if it was otherwise. Regards robert