推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
luztak
V2EX  ›  Python

@Livid @whtsky at/email/url的re

  •  
  •   luztak ·
    luztak · Jul 3, 2012 · 3515 views
    This topic created in 5198 days ago, the information mentioned may be changed or developed.
    @Livid @whtsky

    其中,at_user_filter只适合英文数字用户名,可以带"-"和"_".并且可以过滤邮箱地址.
    email_filter中默认添加了几种常用的后缀,一般也只用得到这些后缀.
    url_filter可以解析http/https/ftp协议/无协议字符的地址,支持泛解析域名,后缀懒得限制,如果需要可以自己改.整个地址支持只有域名,域名加斜杠,域名加目录文件名,并且用了unicode,支持中文.
    目前只有at_user_filter是针对从整段文字抽取做过调整的,email和url特征比at_user复杂,不需要限定条件.
    所有代码在 codepad.org 的Python2.5环境下测试通过.测试结果地址见gist中的test_result_urls.
    2 replies  •  1970-01-01 08:00:00 +08:00
    luztak
        1
    luztak  
    OP
       Jul 3, 2012
    luztak
        2
    luztak  
    OP
       Jul 3, 2012
    @Livid email_filter开头那个\w+我在gist改成\w{1,63}了,这边不动……而且个人信息页的GitHub repos列表也是固定的,难道不能走他们的流量?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2562 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 01:39 · PVG 09:39 · LAX 18:39 · JFK 21:39
    ♥ Do have faith in what you're doing.