Created
May 22, 2010 21:09
-
-
Save jarsen/410366 to your computer and use it in GitHub Desktop.
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 -wKU | |
require 'highline/import' | |
letters_only = /^[a-z]+$/i | |
phone_number = /^\(\d{3}\)\s?\d{3}-\d{4}$/ | |
numbers_below_18 = /^(([0-1]?[0-8])|(-\d*))$/ | |
html_tag = /^<([A-Z]*)>(.*)<\/\1>$/ | |
input = ask "Input text: " | |
until input == "quit" do | |
puts case input | |
when letters_only then "Letters" | |
when phone_number then "Phone Number" | |
when numbers_below_18 then "Number below 18" | |
when html_tag then "HTML tag" | |
else "No matches" | |
end | |
input = ask "Input text: " | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment