枚举正则表达式 [英] Enumerating Regular Expressions

查看:360
本文介绍了枚举正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


有没有人知道一个模块,它允许你枚举特定正则表达式描述的所有

字符串?


干杯,

-Blair

Hi all,

Does anybody know of a module that allows you to enumerate all the
strings a particular regular expression describes?

Cheers,
-Blair

推荐答案

bl ************* @ gmail.com 写道:
大家好,

有没有人知道一个模块,它允许你枚举特定正则表达式描述的所有
字符串?

干杯,< br-> -Blair
Hi all,

Does anybody know of a module that allows you to enumerate all the
strings a particular regular expression describes?

Cheers,
-Blair




你的意思是像re.compile(r''。*'')?


- -

James Stroud

加州大学洛杉矶分校基因组学和蛋白质组学研究所

专栏951570

洛杉矶,CA 90095

http://www.jamesstroud.com/


James Stroud写道:
James Stroud wrote:
你的意思是李ke re.compile(r''。*'')?
You mean like re.compile(r''.*'') ?




编号我的意思是:



No. I mean like:

regex = re.compile(r''a | b'')
regex.enumerate()
a

b
regex = re.compile(r''a|b'')
regex.enumerate() a
b






bl ************* @ gmail.com 写道:
James Stroud写道:
James Stroud wrote:
你的意思是像re.compile(r''。*'')?
You mean like re.compile(r''.*'') ?



编号我的意思是:


No. I mean like:

regex = re.compile(r''a | b'')
regex.enumerate()
regex = re.compile(r''a|b'')
regex.enumerate()



a / br / > b



a
b




你看到难度不是吗?计算机如何提前知道

正则表达式只匹配一组有限的可能字符串?


James


-

James Stroud

UCLA-DOE基因组学和蛋白质组学研究所

Box 951570

洛杉矶,CA 90095

http://www.jamesstroud.com/


这篇关于枚举正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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