First, it's a patently bad idea: my active gmail address has two dots before the @ (think first.middle.last@gmail or similar), and for years, I had an @alumni.collegenamehere.edu alternate email address (until they stopped providing email for alumni). So I personally have had at least two valid, non-spam emails that had more dots than your rules allow. (That's as annoying as the institutions who don't allow my email with a hyphen in the username, so I've had to create an alias email that doesn't include the hyphen.)

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.


In reply to Re: Stopping excessive periods in email by pryrt
in thread Stopping excessive periods in email by htmanning

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.