I am trying to detect email from clipboard using regex.
Sample Input:
[email protected]
[email protected]
[email protected]
Code:
import pyperclip,re
text = pyperclip.paste()
if text:
agentNamesRegex = re.compile(r'\w+\d*@\w+\.\w+')
matches = []
print(agentNamesRegex.findall(text))
Output:(that I am getting)
['[email protected]', '[email protected]', '[email protected]']
Why is [email protected]
part of the output when I have predefined \w+
which means at least one character will be the suffix?
What am I doing wrong?