I am using Python to extract words from a text. I want to extract word that contain@ but not dot.
Regular expression should match following: @bob
, cat@bob
Regular expression should not match: xyz@bob.com
.
I tried following: (?:\w+)?@\w+(?!\.)
- but it extracts @bob
, cat@bob
and xyz@bo
.
Just to elaborate, if I have text "hi @bob and cat@bob my email is xyz@bob.com"
I want to extract @bob
and cat@bob
only from this text. My regular expression above extracts part of xyz@bob.com
(precisely it extracts xyz@bo
). How can I avoid extracting xyz@bob.com
completely.