Skip to content

Instantly share code, notes, and snippets.

@bhalash
Last active January 21, 2016 20:57
Show Gist options
  • Select an option

  • Save bhalash/08c2460b55b0781b34ae to your computer and use it in GitHub Desktop.

Select an option

Save bhalash/08c2460b55b0781b34ae to your computer and use it in GitHub Desktop.
Ruby regex test
#! /usr/bin/env ruby
# http://rubular.com/r/2Z6twnqiB7
# http://rubyfiddle.com/riddles/d4d27
only_letters_regex = /^[A-Za-z]+$/
evil_string = 'Good
123456789
"1" = "1"))/*
or 1=1/*
More Good'
if evil_string =~ only_letters_regex
puts 'MUAHAHAHAHAHAHAHAHAHAHAHA haxx0r3d'
else
puts 'Oh, okay. :('
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment