V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
qanniu
V2EX  ›  Python

请教各位 正则表达式 别名 子串 匹配的问题?

  •  
  •   qanniu · Nov 7, 2015 · 2923 views
    This topic created in 3835 days ago, the information mentioned may be changed or developed.
    想用别名来匹配这样的字符串里面的
    sum=4.375000
    发现不加别名可以,加了别名就无法匹配了?
    用如下表达式无效?? 为什么呢?
    sum=(?P<sum>(\d+(\.\d+)?))

    用如下表达式(移除别名)可以
    sum=(\d+(\.\d+)?)

    sum=((\d+(\.\d+)?))


    ========================

    sum=(?P<sum>\d+) 能匹配到
    sum=4
    3 replies    2015-11-08 16:22:02 +08:00
    purensong
        1
    purensong  
       Nov 7, 2015
    没用过 python ,不过看懂了题主的意思,帮顶
    qanniu
        3
    qanniu  
    OP
       Nov 8, 2015 via iPhone
    感谢,是我用的编辑器问题,感谢回复,找到这个好用的在线监测工具
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5626 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 87ms · UTC 09:00 · PVG 17:00 · LAX 02:00 · JFK 05:00
    ♥ Do have faith in what you're doing.