Mega Code Archive
The match operator =~ can be used to match a string against a regular expression
# If the pattern is found, =~ returns its starting position, or nil.
line = "this is a Perl"
if line =~ /Perl|Python/
puts "Scripting language mentioned: #{line}"
end