Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

email parsing fails #3

Open
adamdecaf opened this issue Oct 23, 2017 · 0 comments
Open

email parsing fails #3

adamdecaf opened this issue Oct 23, 2017 · 0 comments
Labels

Comments

@adamdecaf
Copy link

I found a few valid emails that fail to parse.

From: https://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx/

func TestIsEmail(t *testing.T) {
	emails := []string{
		`Abc\@def@example.com`,
		`Fred\ Bloggs@example.com`,
		`Joe.\\Blow@example.com`,
		`"Abc@def"@example.com`,
		`"Fred Bloggs"@example.com`,
		`customer/department=shipping@example.com`,
		`$A12345@example.com`,
		`!def!xyz%abc@example.com`,
		`_somename@example.com`,
	}
	for i := range emails {
		fmt.Printf("IsEmail(%s)=%v\n", emails[i], IsEmail(emails[i]))
	}
}
IsEmail(Abc\@def@example.com)=false
IsEmail(Fred\ Bloggs@example.com)=false
IsEmail(Joe.\\Blow@example.com)=false
IsEmail("Abc@def"@example.com)=false
IsEmail("Fred Bloggs"@example.com)=false
IsEmail(customer/department=shipping@example.com)=true
IsEmail($A12345@example.com)=true
IsEmail(!def!xyz%abc@example.com)=true
IsEmail(_somename@example.com)=true
@anandp219 anandp219 added the bug label Oct 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants