How to print all expressions that match a regular expression

hzhuo1 at hzhuo1 at
Sat Feb 6 20:36:46 CET 2010


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?



More information about the Python-list mailing list