in reply to Stopping excessive periods in email
Second, you should be able to test it yourself. In this example, I use Test::More unlike (which will have the test pass if it doesn't match the regex, and fail if it does) and throw a bunch of emails at the regex, to see which ones would be "good" emails and which would be "bad". If you have other outlier emails you wanted to test, you could add more emails into the test list
#!perl use 5.012; # strict, // use warnings; use Test::More; for (qw/ test@gmail.com test.test@gmail.com test.test.test@gmail.com test.test.test.test@gmail.com test@subdomain.domain.com test.test@subdomain.domain.com test.test.test@subdomain.domain.com test@test@domain.example test,test@domain.example test@first.example,test@domain.example /, "contains\nnewline\@fake.address") { unlike $_, qr/\@.*\@|,|\..*\..*\.|\n/i, "test '$_'"; } done_testing; __END__ Possible attempt to separate words with commas at C:\Users\peter.jones +\Downloads\TempData\perl\pm.pl line 18. ok 1 - test 'test@gmail.com' ok 2 - test 'test.test@gmail.com' not ok 3 - test 'test.test.test@gmail.com' # Failed test 'test 'test.test.test@gmail.com'' # at C:\Users\peter.jones\Downloads\TempData\perl\pm.pl line 20. # 'test.test.test@gmail.com' # matches '(?^ui:\@.*\@|,|\..*\..*\.|\n)' not ok 4 - test 'test.test.test.test@gmail.com' # Failed test 'test 'test.test.test.test@gmail.com'' # at C:\Users\peter.jones\Downloads\TempData\perl\pm.pl line 20. # 'test.test.test.test@gmail.com' # matches '(?^ui:\@.*\@|,|\..*\..*\.|\n)' ok 5 - test 'test@subdomain.domain.com' not ok 6 - test 'test.test@subdomain.domain.com' # Failed test 'test 'test.test@subdomain.domain.com'' # at C:\Users\peter.jones\Downloads\TempData\perl\pm.pl line 20. # 'test.test@subdomain.domain.com' # matches '(?^ui:\@.*\@|,|\..*\..*\.|\n)' not ok 7 - test 'test.test.test@subdomain.domain.com' # Failed test 'test 'test.test.test@subdomain.domain.com'' # at C:\Users\peter.jones\Downloads\TempData\perl\pm.pl line 20. # 'test.test.test@subdomain.domain.com' # matches '(?^ui:\@.*\@|,|\..*\..*\.|\n)' not ok 8 - test 'test@test@domain.example' # Failed test 'test 'test@test@domain.example'' # at C:\Users\peter.jones\Downloads\TempData\perl\pm.pl line 20. # 'test@test@domain.example' # matches '(?^ui:\@.*\@|,|\..*\..*\.|\n)' not ok 9 - test 'test,test@domain.example' # Failed test 'test 'test,test@domain.example'' # at C:\Users\peter.jones\Downloads\TempData\perl\pm.pl line 20. # 'test,test@domain.example' # matches '(?^ui:\@.*\@|,|\..*\..*\.|\n)' not ok 10 - test 'test@first.example,test@domain.example' # Failed test 'test 'test@first.example,test@domain.example'' # at C:\Users\peter.jones\Downloads\TempData\perl\pm.pl line 20. # 'test@first.example,test@domain.example' # matches '(?^ui:\@.*\@|,|\..*\..*\.|\n)' not ok 11 - test 'contains # newline@fake.address' # Failed test 'test 'contains # newline@fake.address'' # at C:\Users\peter.jones\Downloads\TempData\perl\pm.pl line 20. # 'contains # newline@fake.address' # matches '(?^ui:\@.*\@|,|\..*\..*\.|\n)' 1..11 # Looks like you failed 8 tests of 11.
So in my examples, 3 were "good" emails and the other 8 were "bad".
Since you are the one who is defining what is and isn't a valid email (I disagree with your rules, obviously; but that is irrelevant to the technical perl question of whether you are filtering the emails that you want to filter), only you can decide whether your regex filters enough of them or not.
|
|---|