fork(8) download
  1. import re
  2. p = re.compile(ur'''(\d|\d{2}|\d{4}) # match 1 didget, or two didgets, or four didgets
  3. (\s|-|\.|\/) # match either a space or a dash or a period or a backslash
  4. (\d{2}|\d) # match either 2 digets or one
  5. (\s|-|\.\/) # match either a space or a dash or a period or a backslash
  6. (\d{4}|\d{2}) # match either 4 or 2 didgets.''', re.VERBOSE)
  7. test_str = u"12/25/0000, 10.21.1955, 10-21-1985 6-5-1995 2004/2/21 5/25/2111 4999.2.21 "
  8.  
  9. re.search(p, test_str)
  10. print(p.findall(test_str))
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
[(u'10', u'-', u'21', u'-', u'1985'), (u'6', u'-', u'5', u'-', u'1995')]