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?
EDIT: that regex i came up earlier was not correct! see below for a better answer :-)