not autolinking all-numeric twitter hashtags in perl?

Posted by all_numeric_no_hash on Stack Overflow See other posts from Stack Overflow or by all_numeric_no_hash
Published on 2010-04-22T16:07:38Z Indexed on 2010/04/22 16:53 UTC
Read the original article Hit count: 137

Filed under:
|
|

I'm producing HTML from twitter search results. Happily using the Net::Twitter module :-)

One of the rules in Twitter is that all-numeric hashtags are not links. This allows to unambiguously tweet things like "ur not my #1 anymore", as in here: http://twitter.com/natarias2007/status/11246320622

The solution I came up with looks like:

$tweet =~ s{#([0-9]*[A-Za-z_]+[0-9]*)}{<a href="http://twitter.com/search?q=%23$1">#$1</a>}g;

It seems to work (let's hope), but I'm still curious... how would you do it?

© Stack Overflow or respective owner

Related posts about perl

Related posts about twitter