Strings • Exercise 6/6

Validate Email

00:00
0
25 points

Instructions

Create a function valid_email? that checks if a string looks like
a valid email address using a regular expression.

A simple email pattern should match:
- One or more word characters before @
- The @ symbol
- One or more word characters for domain
- A dot
- 2-4 letters for TLD

Use match? to check if a string matches a pattern:
ruby
"test".match?(/pattern/) # Returns true or false

Your Code

Results

Click "Run Tests" to see results