Could someone tell me what's wrong with this regex?

==============================================
lst = ["2/2/2", "3/3/45", "345/03/45", "4/4/2009", "4/4/12345",
       "12/12/555", "12/12", "2/2", "2/12", "12/2"]

regex = r"\b\d+/\d+/\d{2,4}\b|\b\d{1,2}/\d{1,2}\b"

lst2 = []
for date in lst:
    if not re.search(regex, date):
        lst2.append(date)
print lst2
===============================================

This outputs []

What I want is ['2/2/2', '4/4/12345']

Please?

Dick Moores
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to