I would like to use regular expression to extract only @patrick @michelle from the following sentence:
@patrick @michelle we having diner @home tonight do you want to join?
Note: @home should not be include in the result because, it is not at beginning of the sentence nor is followed by another @name.
Any solution, tip, comments will be really appreciated.
It first matches either an “@” followed by many non-space characters, or the start of line, and then matches another “@” followed by many non-space characters.
Note that it’s common in Twitter that
@nameis preceded byRT, appears in the middle or end of the tweet e.g. http://twitter.com/ceetee/statuses/9874073403. Basically you can’t distinguish whether a @name is really a name just using RegEx or even a parser. The best bet is to check ifhttp://twitter.com/name404 or not.