Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 7
    Related: e-mail.wtf Commented Sep 1 at 12:43
  • 1
    Should the answer ensure that the email addresses are valid and correct the one that aren’t on the expected format (like you seem to do in your example)? Commented Sep 1 at 15:43
  • I don't need to validate the emails Commented Sep 2 at 0:32
  • 3
    fifth.example.com and sixth.example.com are not email addresses, they're domain names. And it would be wrong to just change the first . to an @ because that would break on things like <last.first.example.com> ([email protected]). and changing the second last . to @ would also be wrong because it would break on domains like fifth.example.com.au ([email protected]). These would be valid addresses, but probably not addresses belonging to the users in the input. Anyway, the point is that any such assumption you make is likely to be wrong in at least some cases. Commented Sep 2 at 2:57
  • 2
    yeah, they could be valid local addresses. or, more likely, the input examples were mis-typed (in which case, hugomg should fix the examples). The example output shows them with the first . changed to an @, which is why I explained why that would always be the wrong thing to do. Commented Sep 2 at 6:10