Created
January 19, 2011 16:30
-
-
Save exavolt/786412 to your computer and use it in GitHub Desktop.
Simple Twitter like mention with RegEx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
_user_re = re.compile(r"""\B@([0-9a-zA-Z_]+)""") | |
def mentionify(text) | |
return _user_re.sub(r'@<a href="/user/\1">\1</a>', text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment