0
how to not print @ in both usename and typemail?
4 Antworten
+ 3
Mr. 12 This is where lookarounds come in handy - they will match things that will not appear in the matched string.
The regex '\S+(?=@)' will match a sequence of non-whitespace characters that appear immediately before the '@' symbol - (?=...) is the notation for a lookahead.
And, '(?<=@)\S+' will match a sequence of non-whitespace characters that appear immediately after the '@' symbol - (?<=...) is the notation for a lookbehind.
Hope that makes sense!
https://code.sololearn.com/cc4XlRxT852Y/?ref=app
+ 2
you could just split the mail string at the @ symbol.
email, domain = "test123@gmail.com".split("@")
print(email)
print(domain)
# output:
test123
gmail.com
0
yes bro, i know it.
i am learning regex now. thats why i am using regex. i have already done this program without regex.
https://code.sololearn.com/cCOlB1YA50j1/?ref=app
0
regex is more a search for a specific structured string. At most it should be used to replace certain characters.
try making a regex for complete emails or even the youtube link finder in code coach!