This seems to work for me, although it looks ugly (perhaps in a more attractive way, this can be done):
!(string =~ /^ee$/).nil?
Of course, everything inside // above can be any regular expression you want.
Example:
>> string = "street" => "street" >> !(string =~ /^ee$/).nil? => false >> string = "ee" => "ee" >> !(string =~ /^ee$/).nil? => true
Note. Tested in Rails console with ruby ββ(1.8.7) and rails (3.1.1)
Brian Cordeiro Dec 13 2018-11-11T00: 00Z
source share