Commits

Josh VanderLinden  committed 0dde46c

Updated the regex that finds hashtags. This one should be a bit more reliable.

  • Participants
  • Parent commits db86a2f

Comments (0)

Files changed (1)

 log = logging.getLogger('twibber.core')
 
 AT_REPLY_RE = re.compile('@(\w+)')
-HASH_TAG_RE = re.compile('([^&]?)#([\w\-]+)([^;]?)')
+HASH_TAG_RE = re.compile('(?<!&)#([\w\-]+)')
 HREF_RE = re.compile('(http://([\w+?\.\w+]+)([a-z0-9\~\!\@\#\$\%\^\&amp;\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*))', re.I)
 HREF_TEMPLATE = '<strong><a href="http://twitter.com/%(user)s/status/%(id)i">%(user)s</a></strong>'
 
                 n['c'] = ' style="font-weight:bold;color:red;font-style:italic;"'
             text = text.replace('@' + username, template % n)
         text = HASH_TAG_RE.sub(
-            r'\1<em><a href="http://twitter.com/#search?q=%23\2">#\2</a></em>\3',
+            r'<em><a href="http://twitter.com/#search?q=%23\1">#\1</a></em>',
             text)
 
         replacements = (