Aleksi Niemel<aleksi.niemela / cinnober.com> writes:

> Dave's example for MatchData.[] 
> 
>   m = /(.)(.)(\{}d+)(\{}d)/.match("THX1138.")
> 
> returns nil on my Win (rbdj144) environment. I was wondering for a while why
> you have (\{}d+) and then I got it. Maybe it belongs to the same class as
> other Latex environments :). Haven't seen such regexp anyway.

Sorry about that - this LaTeX to html conversion is tough, but we'll
get the bugs out. Unfortunately we've having to do it ourselves - the
standard latex2html script chokes on much of our stuff.

> ruby> m=/(.)(.)(\d+)(\d)/.match("THX1138.")
> #<MatchingData:0x246a00>
> ruby> m[0]
> ""
> ruby> m[0,5]
> [nil]

That's a problem with using eval.rb.

Try typing it into a file and running it, or better yet, have a play
with irb:

     dave[ruby/sample 10:39:33] irb
     irb(main):001:0> m=/(.)(.)(\d+)(\d)/.match("THX1138.")
     #<MatchData:0x401c1e90>
     irb(main):002:0> m[0]
     "HX1138"
     irb(main):003:0> m[0,5]
     ["HX1138", "H", "X", "113", "8"]



Dave