Python 正则表达式是否支持 Perl 的 G 之类的东西? [英] Do Python regexes support something like Perl's G?

查看:22
本文介绍了Python 正则表达式是否支持 Perl 的 G 之类的东西?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Perl 正则表达式(显示为 here,虽然理解整个事情并不希望回答这个问题所必需的)包含 G 元字符.我想将它翻译成 Python,但 Python 似乎不支持 G.我能做什么?

I have a Perl regular expression (shown here, though understanding the whole thing isn't hopefully necessary to answering this question) that contains the G metacharacter. I'd like to translate it into Python, but Python doesn't appear to support G. What can I do?

推荐答案

Python 的正则表达式没有/g 修饰符,因此没有 G 正则表达式标记.很遗憾,真的.

Python does not have the /g modifier for their regexen, and so do not have the G regex token. A pity, really.

这篇关于Python 正则表达式是否支持 Perl 的 G 之类的东西?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆