Skip to content

Instantly share code, notes, and snippets.

@ksexton
Created April 19, 2013 14:42
Show Gist options
  • Save ksexton/5420790 to your computer and use it in GitHub Desktop.
Save ksexton/5420790 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
my_word = "foo"
word = "foo"
if my_word =~ /#{word}/
puts "#{my_word} has #{word} in it"
else
puts "#{my_word} doesn't have #{word} in it"
end
# Output:
# $ ./regex.rb
# foo has foo in it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment