Hey Craig,
We found an addition to this. Your regex is great, but it doesn't
limit the length of screen names. Twitter doesn't allow signups
greater than 15 chars (but in tweets, it will actually link up to 20
chars).
So, @abcdefghijklmnopqrstuvwxyz will be linked out to
@abcdefghijklmnopqrst
\...@[\w\d_]{1,15}
This also works in Ruby.
-- Tim
On May 12, 2:01 pm, ericdoesdot...@gmail.com
ericdoesdot...@gmail.com wrote:
Hi Everyone,
In .NET, I use the regex: \...@[\w\d_]+
This pattern exhibits the behavior described by Doug -- it finds the
mentions @bob, @BOB, @bob and -...@bob, but not _...@bob and h...@bob.
I sent the following tweet:
`...@a ~...@a !...@a @@a #...@a $...@a %...@a ^...@a @a *...@a (@a )@a
_...@a +...@a -...@a =...@a [...@a
{...@a ]...@a }...@a \...@a |@a ;@a :@a '@a @a ,@a @a @a @a /@a ?...@a
a...@a 1...@a
Twitter and my pattern both did not match _...@a and a...@a and 1...@a.
On May 12, 8:13 am, CaMason stasisme...@googlemail.com wrote:
It looks like they're simply applying this regex as a test:
(?![\w])@username(?![\w])
Thus, if a character on either side is not (a-z, A-Z, 0-9, _) then it
is a mention. any 'word' character (a-z, A-Z, 0-9, _) on either side
of '@screenname' causes the mention to fail.
(I hope I got the regex explanation correct!).
-Craig
On May 12, 12:33 pm, hjb ha...@heatonmoor.com wrote:
@Doug,
Is this behavour likely to remain? ( I noticed that @replies and -
@replies are successful )
That is to say, I'm sure @replies will work at some point via sms, but
can we rely on the fact that _...@replies do not? Is this related to
there being any chance of it being an email address?
Thanks,
Harry
On May 11, 6:26 pm, Doug Williams d...@twitter.com wrote:
In my test posts @dougw and @DOUGW worked as mentions. t...@dougw and
_...@dougw were not included as mentions.
Thanks,
Doug
--
Doug Williams
Twitter Platform Supporthttp://twitter.com/dougw
On Mon, May 11, 2009 at 10:16 AM, CaMason
stasisme...@googlemail.comwrote:
Thanks Doug, that's a great help.
How about preceding?
i.e. should t...@dougw, _...@dougw or @dougw create mentions?
The
main concern here obviously is email addresses.
And finally, are screen names case sensitive? :)
Cheers
On May 11, 6:07 pm, Doug Williams d...@twitter.com wrote:
The classic definition of an @reply is any tweet that starts with
@user.
If
you perfrom a to:user (e.g. to:dougw) query at search.twitter.com
you
will
only get @replies. @replies were converted to mentions after we
realized
people didn't just @reply. Mentions are any tweet that contain @user
within
the text of the tweet.
So @replies are a subset of mentions.
Any non-alphanumeric (where alphanumeric is a-z, 0-9, or _) can
terminate
the username. For instance: hi @dougw, you look dapper today is a
mention.
Thanks,
Doug
--
Doug Williams
Twitter Platform Supporthttp://twitter.com/dougw
On Mon, May 11, 2009 at 2:36 AM, stasisme...@googlemail.com
stasisme...@googlemail.com wrote:
Hi guys,
For an application I'm working on, we have a single table for
'tweets'
and another for DMs. We're linking TwitterUsers to Tweets with a
many:many, and a simple flag to specify if the tweet is a reply/
mention.
We first pull in messages from the user_timeline feed, then the
mentions feed. As such, we'd like to check if any of the messages
in
user_timeline feed is actually a reply.
Could anybody clarify the exact rules that are used to determine
whether a string is a reply/mention?
i.e.
preceded by start-of-string or non-word character...
followed by space, comma, period or end of message...
case insensitive...
[not even sure if these are correct! :) ]
Currently I'm using:
/(?![^\W_])@%s(?![^\W_])/i
with %s replaced by the user's screen name. Perhaps one of the
devs
could share the exact rules (or even the regex), or propose a
nicer
mechanism for detecting replies.
(I did propose checking for replies before tweets, but these
update
threads are run asynchronously).
Cheers- Hide quoted text -
- Show quoted text -