Initial Answer
Try the following regex:
@(?! )
Here are a couple examples of how it performs:
>>> print re.sub(r'@(?! )', '', '@Alice @ home')
Alice @ home
>>> print re.sub(r'@(?! )', '', 'Whatever @Alice @ home')
Whatever Alice @ home
You can also test it with a related regex fiddle.
Key points:
@ – the at-sign
(?! ) – a negative lookahead that matches anything but a space (i.e. not followed by a space)
Personally I find the zero-width word-boundary assertions (\b and \B) a bit distracting and prefer to use zero-width lookarounds for this sort of thing, but TMTOWTDI.
About-face
I thought about this more (as usual), and what I found is admittedly a compelling case for the zero-width word-boundary assertions' simplicity and start- and end-of-string matching.
Consider a fuller set of conceivable tweets:
@Alice @ home
Whatever @Alice @ home
What're you lookin' @
What're you lookin' @?
It turns out that to get these right requires a much more complicated negative lookahead, turning my initial regex into:
@(?![ \W]|$)
As before, here are examples of how it performs:
>>> print re.sub(r'@(?![ \W]|$)', '', '@Alice @ home')
Alice @ home
>>> print re.sub(r'@(?![ \W]|$)', '', 'Whatever @Alice @ home')
Whatever Alice @ home
>>> print re.sub(r'@(?![ \W]|$)', '', "What're you lookin' @")
What're you lookin' @
>>> print re.sub(r'@(?![ \W]|$)', '', "What're you lookin' @?")
What're you lookin' @?
And as before, you can also test it with a related regex fiddle.
But a word-boundary pattern like Avinash Raj employed gets this fuller set of conceivable tweets right...with much less fanfare:
>>> print re.sub(r'\B@\b', '', '@Alice @ home')
Alice @ home
>>> print re.sub(r'\B@\b', '', 'Whatever @Alice @ home')
Whatever Alice @ home
>>> print re.sub(r'\B@\b', '', "What're you lookin' @")
What're you lookin' @
>>> print re.sub(r'\B@\b', '', "What're you lookin' @?")
What're you lookin' @?
Test it out with another related regex fiddle if you like too.
Bottom line, this has been a cool learning experience for me to question what I tend to prefer using, and I hope you find it the same: onward on our word-boundary-assertion adventures! :)