5 kyu
Email Validation
1,204 of 1,218georgeu2000
Description:
Create a function validate()
that takes a string email address and returns true if valid, false otherwise.
A valid email is defined as:
- Has an
@
symbol within - Has dots splitting up two or more strings at the right of the
@
. - Has contents to the left of the
@
. Only one part is needed. Multiply parts should be seperated with dots.
For example:
validate('joe@example.com') => true
validate('joe.codewars@example.com') => true
validate('joe') => false # does not contain @ symbol, does not contain two or more strings seperated by a dot after the @ symbol
validate('@.') => false #nothing to the left of the @, does not adhere to rule 2 in the description
Here's a tool that may help: http://rubular.com/
Regular Expressions
Strings
Algorithms
Similar Kata:
Stats:
Created | Oct 30, 2013 |
Published | Oct 30, 2013 |
Warriors Trained | 2270 |
Total Skips | 281 |
Total Code Submissions | 9021 |
Total Times Completed | 1218 |
Ruby Completions | 1204 |
Total Stars | 31 |
% of votes with a positive feedback rating | 78% of 108 |
Total "Very Satisfied" Votes | 74 |
Total "Somewhat Satisfied" Votes | 21 |
Total "Not Satisfied" Votes | 12 |
Total Rank Assessments | 14 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 7 kyu |