Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby -wKU
- 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>$/
- print "Input text: "
- input = gets.strip
- 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
- print "Input text: "
- input = gets.strip
- end
Add Comment
Please, Sign In to add comment