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.
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
Further reading: