Skip to content

Instantly share code, notes, and snippets.

@LondheShubham153
Created October 15, 2020 08:57
Show Gist options
  • Save LondheShubham153/fd71b9a965dcc31846b2a337ae13f3c2 to your computer and use it in GitHub Desktop.
Save LondheShubham153/fd71b9a965dcc31846b2a337ae13f3c2 to your computer and use it in GitHub Desktop.
Email splitter
import re
regexStr = r'^([^@]+)@[^@]+$'
emailStr = 'shubhamnath5@gmail.com'
username = re.search(regexStr, emailStr)
print(username.group(1))

#or

emailStr = 'shubhamnath5@gmail.com'
emailStr.split("@")[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment