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
DaFee
V2EX  ›  Python

各位老铁,我是真的没找到资料,我想做一个类似这篇博客文章里面的列出所有正则匹配过程。

  •  
  •   DaFee · 2021-03-30 13:46:14 +08:00 · 1722 次点击
    这是一个创建于 1094 天前的主题,其中的信息可能已经有所发展或是发生改变。

    文章地址: https://blog.doyensec.com/

    This visualisation of the matching steps was produced by emitting verbose debugging from cpython’s regex engine using my cpython fork.
    

    文章当中说是通过 cpython 实现的,但是我用 debug 模式呈现不了他那样的效果。

    7 条回复    2021-03-31 09:39:56 +08:00
    aloxaf
        1
    aloxaf  
       2021-03-30 13:55:38 +08:00
    regex101
    phony2r
        2
    phony2r  
       2021-03-30 14:08:25 +08:00
    no1xsyzy
        3
    no1xsyzy  
       2021-03-30 14:21:49 +08:00
    > This visualisation of the matching steps was produced by emitting verbose debugging from cpython’s regex engine using my cpython fork.

    他用了一个自己的 fork,在 regex 引擎中产生了更多的信息。
    DaFee
        4
    DaFee  
    OP
       2021-03-30 16:32:49 +08:00
    @no1xsyzy 我其实就是想知道怎么在 regex 引擎中产生这些信息。。。
    DaFee
        5
    DaFee  
    OP
       2021-03-30 16:34:19 +08:00
    提供点思路就行
    no1xsyzy
        6
    no1xsyzy  
       2021-03-30 19:23:40 +08:00
    https://github.com/bcaller/cpython/compare/fbc7723..2c67561
    还有这个 commit message: https://github.com/bcaller/cpython/commit/bc453d1

    没研究过 CPython 源代码,以下表述来源于技能“直觉 EX+”
    首先,打开 VERBOSE 之类的符号,并且在许多地方嵌入 TRACE
    然后用 spit.py 来 parse 输出。
    DaFee
        7
    DaFee  
    OP
       2021-03-31 09:39:56 +08:00
    @no1xsyzy 好的,谢谢。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3205 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 11:58 · PVG 19:58 · LAX 04:58 · JFK 07:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.