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

正则表达式如何匹配后面『是某个模式』或『是行尾』?

  •  
  •   liberize ·
    liberize · Sep 24, 2014 · 4363 views
    This topic created in 4256 days ago, the information mentioned may be changed or developed.
    使用零宽断言可以匹配后面『是某个模式』,但后面也可能『是行尾』,应该怎么写?
    2 replies    2014-09-24 20:01:14 +08:00
    icedx
        1
    icedx  
       Sep 24, 2014 via Android
    r'Nyan|$'
    匹配Nyan字符或行尾
    liberize
        2
    liberize  
    OP
       Sep 24, 2014
    刚刚发现 xxx(?=(pattern|$)) 是可以工作的,结帖
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5030 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 290ms · UTC 09:32 · PVG 17:32 · LAX 02:32 · JFK 05:32
    ♥ Do have faith in what you're doing.