[issue38582] re: backreference number in replace string can't >= 100

veaba report at bugs.python.org
Thu Oct 24 21:59:15 EDT 2019


veaba <908662421 at qq.com> added the comment:

这里来自实际我的一个项目(https://github.com/veaba/tensorflow-docs/blob/master/scripts/spider_tensorflow_docs.py#L39-L56),当然也许我这个方法不是正确的,它只是我刚学python的一个尝试。

这个项目步骤是这样:根据HTML tag 提取文本转为markdown格式。<code> 标签,需要用符号“`”包围,然后循环里面将匹配的字符通过\\* 替换出来。

所以,你们见到了,我发现这样的一个正则溢出错误。


如果能够放开反斜杠替换符无限个数限制对我会很友好,当然如果真的不需要的话,我自己想别的办法。

————————————————————————————————————
This is from a project I actually worked on (https://github.com/veaba/tensorflow-docs/blob/master/scripts/spider_tensorflow_docs.py#L39-L56). Of course, this method is not correct. It's just an attempt to learn python.



The project steps are as follows: extract the text according to HTML tag and change it to markdown format. The < code > label needs to be surrounded by the symbol "`", and then the matching characters are replaced by \ \ * in the loop.



So, as you can see, I found such a regular overflow error.




It would be nice for me to be able to let go of the infinite number of backslash substitutions. Of course, if I really don't need it, I'll try something else.

----------
hgrepos: +385

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38582>
_______________________________________


More information about the Python-bugs-list mailing list