V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
shyrock
V2EX  ›  Python

这行正则表达式谁给解读一下?r“((?P<w>\d)(?P=w)*)”,先谢了

  •  
  •   shyrock · 2014-06-23 16:33:08 +08:00 · 3667 次点击
    这是一个创建于 3608 天前的主题,其中的信息可能已经有所发展或是发生改变。
    pythonchallenge第十题的一个答案。。。
    8 条回复    2014-06-24 11:56:13 +08:00
    LazyZhu
        1
    LazyZhu  
       2014-06-23 16:38:02 +08:00   ❤️ 1
    正则表达式30分钟入门教程 http://deerchao.net/tutorials/regex/regex.htm
    9hills
        2
    9hills  
       2014-06-23 16:39:18 +08:00
    http://regex101.com/ ,直接吧正则贴进去就好了
    emric
        3
    emric  
       2014-06-23 16:41:23 +08:00
    shyrock
        4
    shyrock  
    OP
       2014-06-23 16:56:52 +08:00
    写各位回答,其实主要没看懂那个大写的P是啥意思,教程里面也没有查到。。。谁能说明一下?
    shyrock
        6
    shyrock  
    OP
       2014-06-23 17:13:32 +08:00
    @LazyZhu 懂了,原来是是python的扩展。。。
    revlis7
        7
    revlis7  
       2014-06-24 11:51:21 +08:00
    不是python扩展,是分组命名
    shyrock
        8
    shyrock  
    OP
       2014-06-24 11:56:13 +08:00
    @revlis7 标准re里面命名分组是(?<命名>表达式),这个P是python的扩展,参考5楼的邮件。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1051 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 22:18 · PVG 06:18 · LAX 15:18 · JFK 18:18
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.