/lib/utils.py
Python | 11 lines | 4 code | 3 blank | 4 comment | 1 complexity | 73a50b8f5328bc51288d9ebb6900680e MD5 | raw file
- #!/usr/bin/env python
- # coding=utf-8
- #
- # Copyright 2013 3n1b.com
- import re
- def find_mentions(content):
- regex = re.compile(ur"@(?P<username>(?!_)(?!.*?_$)(?!\d+)([a-zA-Z0-9_\u4e00-\u9fa5]+))(\s|$)", re.I)
- return [m.group("username") for m in regex.finditer(content)]