Has Twitter ever shared their logic for locating @usernames and hash tags?

@([A-Za-z0-9_]+)
The above regex seems logical but I can see faults. It will pick up the trailing domain in an email address.

I could look for a whitespace in front, or nothing in front and do better.

Then there is the (via:@username) which luckily has a colon, but there are cases where it does not, making a very special case.

Hash tags can be strange like #hash/foo

Any suggestions on the most reliable patterns? Twitter does a very good job, catching "string,@username" as just @username but not messing up on email addresses.
--
Scott
Iphone says hello.

Reply via email to