Last active
January 21, 2016 20:57
-
-
Save bhalash/08c2460b55b0781b34ae to your computer and use it in GitHub Desktop.
Ruby regex test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /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