This meant that #match return worked like an array. I was just
running the unit tests on Text::Format (new release coming shortly)
and the values were a MatchData, nil, nil. I’ve fixed this by
explicitly using l[1] and l[2] when I need it, but has this changed,
or did it work by accident previously? (I’m using 1.6.8 mswin32.)
This meant that #match return worked like an array. I was just
running the unit tests on Text::Format (new release coming shortly)
and the values were a MatchData, nil, nil. I’ve fixed this by
explicitly using l[1] and l[2] when I need it, but has this changed,
or did it work by accident previously? (I’m using 1.6.8 mswin32.)
I don’t think that’s changed. Can you give a whole demo of the
different behaviors?
I must correct myself – I was originally using the 1.7 release by
PragProg. So my unit test would have failed under 1.6.7; I just
never tested it to be sure. What I’m doing now:
l = /((?:\S+\s+){11}(.+)/.match(line)
And then using l[1] and l[2] is safer and more portable betweeen
versions, IMO.
I think that expecting #match to return an array in any case is a
bad thing. But that’s just IMO.
-austin
– Austin Ziegler, austin@halostatue.ca on 2003.03.31 at 23:12:16