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

2021-03-30 13:46:14 +08:00
 DaFee

文章地址: 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 模式呈现不了他那样的效果。

1749 次点击
所在节点    Python
7 条回复
aloxaf
2021-03-30 13:55:38 +08:00
regex101
phony2r
2021-03-30 14:08:25 +08:00
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
2021-03-30 16:32:49 +08:00
@no1xsyzy 我其实就是想知道怎么在 regex 引擎中产生这些信息。。。
DaFee
2021-03-30 16:34:19 +08:00
提供点思路就行
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
2021-03-31 09:39:56 +08:00
@no1xsyzy 好的,谢谢。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/766477

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX