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

Stats:

CreatedOct 30, 2013
PublishedOct 30, 2013
Warriors Trained2270
Total Skips281
Total Code Submissions9021
Total Times Completed1218
Ruby Completions1204
Total Stars31
% of votes with a positive feedback rating78% of 108
Total "Very Satisfied" Votes74
Total "Somewhat Satisfied" Votes21
Total "Not Satisfied" Votes12
Total Rank Assessments14
Average Assessed Rank
5 kyu
Highest Assessed Rank
4 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • georgeu2000 Avatar
  • jhoffner Avatar
  • WestwardLand968 Avatar
Ad