B
Bil.Kleb
How do I shim 1.6 for String.match?
I've tried,
unless String::respond_to?
match)
class String
def match(regex)
regex.match(self)
end
end
but it doesn't set the group match variables, e.g.,
$1, $2, and so forth.
(Note: the above doesn't even attempt to deal with
converting a string to a regexp as 1.8's String.match
does.)
Thanks,
I've tried,
unless String::respond_to?
class String
def match(regex)
regex.match(self)
end
end
but it doesn't set the group match variables, e.g.,
$1, $2, and so forth.
(Note: the above doesn't even attempt to deal with
converting a string to a regexp as 1.8's String.match
does.)
Thanks,