Development Ruby

def probably_valid?(email)
 valid = '[A-Za-z\d.+-]+' # Commonly encountered email address characters
 (email =~ /#{valid}@#{valid}\.#{valid}/) == 0
end
#These give the correct result.
probably_valid? 'joe@example.com'                # => true
probably_valid? 'joe@examplecom'                 # => false