# !/usr/bin/ruby -w # -*- encoding:utf-8 -*- # filename: main.rb # author: 简单教程(www.twle.cn) # Copyright © 2015-2065 www.twle.cn. All rights reserved. str1 = "Cats are smarter than dogs"; str2 = "Dogs also like meat"; if ( str1 =~ /Cats(.*)/ ) puts "str1 contains Cats" end if ( str2 =~ /Cats(.*)/ ) puts "str2 contains Dogs" end