Sophrinix / TryRuby

Try Ruby is a interactive shell that quickly and whimsically teaches the Ruby programming language. Originally _why's idea, it has been recreated from the ground up by Rubyists who have a passion for Ruby and for teaching their fellow (wo)man how to program.
tryruby.org
347 stars 79 forks source link

Regex patterns problem? #136

Open jon80 opened 13 years ago

jon80 commented 13 years ago

I'm trying to write the following code postcode = 'NXR1012'

regex pattern for Maltese post code (3 letters followed by 3 numbers) for simplicity letters are assumed to be in UPPERCASE

if postcode =~ /[A-Z][A-Z][A-Z][0-9][0-9][0-9][0-9]/ puts "valid Maltese postcode - www.maltapost.com for further info" end

  1. Cannot write the above code within www.tryruby.org
  2. Cannot use backspace when I make a mistake and want to delete the last character that I typed in.

Further reading:

  1. Programming Ruby at http://www.ruby-doc.org/docs/ProgrammingRuby.
  2. Regular expressions tutorial at http://www.regular-expressions.info/tutorial.html.