Am Tue, 26 Jul 2005 09:57:23 +0000 schrieb Odd-R.: > Input is a string of four digit sequences, possibly > separated by a -, for instance like this > > "1234,2222-8888,4567," > > My regular expression is like this: > > rx1=re.compile(r"""\A(\b\d\d\d\d,|\b\d\d\d\d-\d\d\d\d,)*\Z""")
Hi, try it without \A and \Z import re rx1=re.compile(r"""(\b\d\d\d\d,|\b\d\d\d\d-\d\d\d\d,)""") print rx1.findall("1234,2222-8888,4567,") # --> ['1234,', '2222-8888,', '4567,'] Thomas -- Thomas Güttler, http://www.thomas-guettler.de/ -- http://mail.python.org/mailman/listinfo/python-list