How to print all expressions that match a regular expression

hzhuo1 at gmail.com hzhuo1 at gmail.com
Sat Feb 6 19:05:15 EST 2010


Thanks for your reply.
So there isn't such a routine just because some of the regular
expressions cannot be enumerated. However, some of them can be
enumerated. I guess I have to write a function myself.

Zhuo

On Feb 6, 5:23 pm, Roy Smith <r... at panix.com> wrote:
> In article
> <ee2cfd35-3171-4ee7-ad3a-cf117e552... at r24g2000yqd.googlegroups.com>,
>
>
>
>
>
>  "hzh... at gmail.com" <hzh... at gmail.com> wrote:
> > Hi,
>
> > I am a fresh man with python. I know there is regular expressions in
> > Python. What I need is that given a particular regular expression,
> > output all the matches. For example, given ³[1|2|3]{2}² as the regular
> > expression, the program should output all 9 matches, i.e., "11 12 13
> > 21 22 23 31 32 33".
>
> > Is there any well-written routine in Python or third-party program to
> > do this? If there isn't, could somebody make some suggestions on how
> > to write it myself?
>
> > Thanks.
>
> > Zhuo
>
> Please enumerate all the strings which match ".*".  Use additional sheets
> of paper if needed.




More information about the Python-list mailing list