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: [email protected]
.
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 [email protected]"
I want to extract @bob
and cat@bob
only from this text. My regular expression above extracts part of [email protected]
(precisely it extracts xyz@bo
). How can I avoid extracting [email protected]
completely.