[Python] Using RegEx
\n\nclass Solution:\n    def numUniqueEmails(self, emails):\n        expression, emails_set = r\'([a-z0-9.]+)\\+?.*@(\\S+)\', set()\n        \n        for email
\n```\nclass Solution:\n    def numUniqueEmails(self, emails):\n        expression, emails_set = r\'([a-z0-9.]+)\\+?.*@(\\S+)\', set()\n        \n        for email in emails:\n            matches = re.findall(expression, email)\n            email = re.sub(r\'\\.\', \'\', matches[0][0]) + \'@\' + matches[0][1]\n            emails_set.add(email)\n\n        return len(emails_set)\n```\n\n\n\n---------\n\nIf you wish to simplify/update/explore the expression, it\'s been explained on the top right panel of [regex101.com](https://regex101.com/r/EEfeNu/1/). You can watch the matching steps or modify them in [this debugger link](https://regex101.com/r/EEfeNu/1/debugger), if you\'d be interested. The debugger demonstrates that how [a RegEx engine](https://en.wikipedia.org/wiki/Comparison_of_regular_expression_engines) might step by step consume some sample input strings and would perform the matching process. \n\n---------\n\n### RegEx Circuit\n\n[jex.im](https://jex.im/regulex/#!flags=&re=%5E(a%7Cb)*%3F%24) visualizes regular expressions: \n\n![image](https://assets.leetcode.com/users/emtrade/image_1575064831.png)\n\n\n\n### Without RegEx\n\n```\nclass Solution:\n    def numUniqueEmails(self, emails):\n        visited = set()\n        for email in emails:\n            user, site = email.split(\'@\')\n            local = user.split(\'+\')[0].replace(\'.\', \'\')\n            visited.add(f\'{local}@{site}\')\n\n        return len(visited)\n```\n\n### Reference\n\n[Explains it here](https://leetcode.com/problems/unique-email-addresses/discuss/186798/JavaPython-3-7-and-6-liners-with-comment-and-analysis.)
['Python', 'Python3']