Created
November 5, 2014 07:32
-
-
Save bernEsp/baad9e63689f64a1ecb2 to your computer and use it in GitHub Desktop.
regex to validate email with names and delimiter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Regexp.new('\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})(\z|\s<\w+(?:>\z|\s\w+>\z))', true) |~ | |
Regexp.new('(?:\A|,{1})(?:<{0,1})([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})(?:>{0,1})', true) |~ | |
Regexp.new('(?:\s<|w+\s)([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})(?:>|,{0,1}\z)', true) |~ | |
Regexp.new('(?:^([^<@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})|^(?:\w+\s)+<{1}([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})(?:>{1}$))', true) | |
Regexp.new('(?:^([^<@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z|^(?:\w+\s)+<{1}([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})(?:>{1}$))', true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment