Does this work?

irb(main):001:0> blah = "CHLE,231,1"
=> "CHLE,231,1"
irb(main):002:0> def blah.[](s)
irb(main):003:1>   a = self.split(",")
irb(main):004:1>   b = s.split(",")
irb(main):005:1>   a[0, b.size] == b ? s : nil
irb(main):006:1> end
=> nil
irb(main):007:0> blah["CHLE,231,1"]
=> "CHLE,231,1"
irb(main):008:0> blah["CHLE,231"]
=> "CHLE,231"
irb(main):009:0> blah["CHLE,232"]
=> nil
irb(main):010:0> blah["CHLE,231,2"]
=> nil
irb(main):011:0> blah["CHLE,23"]
=> nil
-- 
Posted via http://www.ruby-forum.com/.