Skip to content

Instantly share code, notes, and snippets.

@oki
Created January 3, 2009 10:34
Show Gist options
  • Select an option

  • Save oki/42823 to your computer and use it in GitHub Desktop.

Select an option

Save oki/42823 to your computer and use it in GitHub Desktop.
def scan(text)
text =~ /^([0-9]{1,2})[-\.]([0-9]{1,2})[-\.]([0-9]{4})/
end
loop do
loop do
puts "Podaj pierwsza date (format: dd-mm-rrrr)"
if scan(d1 = gets.chop!)
break
end
end
loop do
puts "Podaj druga date (format: dd-mm-rrrr)"
if scan(d2 = gets.chop!)
break
end
end
puts "OK, obie daty sa poprawne"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment