Skip to content

Instantly share code, notes, and snippets.

@cbhl
Created February 27, 2014 15:55
Show Gist options
  • Save cbhl/9252836 to your computer and use it in GitHub Desktop.
Save cbhl/9252836 to your computer and use it in GitHub Desktop.
dt.py
import re
import sys
p = re.compile("([0-9]{1,2}/[0-9]{1,2}/[0-9]{2,4} [0-9]{1,2}:[0-9]{2}:[0-9]{2}( (AM|PM|am|pm))?)")
for x in p.findall(sys.stdin.read()):
print x[0]
@cbhl
Copy link
Author

cbhl commented Feb 27, 2014

This Python script prints all date-like strings of the form #/#/#### #:##:## and ##/##/#### ##:##:## as well as some other permutations that probably aren't dates.

It will almost certainly print things that look like dates but aren't actually, but it should be a reasonable starting point.

Run it like follows from the command line:

C:\> python dt.py < somefile.txt

You will need to install Python, of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment