What's the problem?

Report a typo

Some time ago you were asked to write a program that returns a string if there is the @ character before it. However, your code raises an error even though it is obvious that the strings match the pattern. Can you correct the code and solve this issue?

Sample Input 1:

@Jane123

Sample Output 1:

Jane123
Write a program in Python 3
import re

string = input()
pattern = "(?<=@)\w+"
results = re.match(pattern, string)
print(results.group())
___

Create a free account to access the full topic