推荐学习书目
› 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
kenneth
V2EX  ›  Python

菜鸟请教一个Python正则问题

  •  
  •   kenneth · May 23, 2013 · 3837 views
    This topic created in 4913 days ago, the information mentioned may be changed or developed.
    https://gist.github.com/kenneth/5633351

    想去掉content中的ubb,只要链接,应该如何写?

    请高手赐教。
    9 replies  •  1970-01-01 08:00:00 +08:00
    jason52
    jason52
    May 23, 2013
    1
    您是想抓图?哪里有ubb呢?
    jason52
    jason52
    May 23, 2013
    2
    you mean URL?
    dreampuf
    dreampuf
    May 23, 2013❤️1
    4
    dreampuf
    dreampuf
    May 23, 2013
    5
    import re
    re.search("\\[(?:([^=]+)=([^\\]]+)|([^\\]]+))\\]([^\\[]+)\\[/(?:\\1|\\3)\\]", searchText)
    KotiyaSanae
    KotiyaSanae
    May 23, 2013
    7
    @kenneth 没太看懂你要匹配什么,是所有的boston么?那个网站不太会用……
    pattern = r'.*](http://.*html?).*' ? python环境下通过……
    jason52
    jason52
    May 23, 2013
    8
    这种事强烈推荐用pyquery做 代码可以很简单 抓图代码就这么一点
    http://dpaste.com/1196576/
    jason52
    jason52
    May 23, 2013
    9
    @KotiyaSanae 如果用re的话这种可以
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5229 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 06:13 · PVG 14:13 · LAX 22:13 · JFK 01:13
    ♥ Do have faith in what you're doing.