On 05/20/2014 07:16 PM, Brian Mathis wrote:
> This is a bug in validate_re(), even though there is a workaround.
Arguably so.
One could also argue, on the other hand, that regular expressions are
matched by *strings* and nothing else. Sure, we've been spoiled by bash
and perl which don't give damn and implicitly convert to string every
chance they get. But that isn't a universal truth. Point in fact
irb(main):001:0> puts "it works!" if 5 =~ /[0-9]+/
=> nil
I agree that it *is* inconvenient to check for two cases "is numeric" or
"contains a number" when logically the former implies the latter. I also
think that implicit string conversion would be a beneficial feature for
validate_re. But it is not necessarily a bug.
Cheers,
Felix