Given a string with a date in an unknown format and other text, how can I separate the two?
>>dparser.parse("monkey 2010-07-10 love banana",fuzzy=True)
datetime.datetime(2010, 7, 10, 0, 0)
from Extracting date from a string in Python is a step in the right direction, but what I want is the non-date text, for example:
date = 2010-07-10
str_a = 'monkey', str_b = 'love banana'
If the date string didn't have spaces in it, I could split the string and test each substring, but how about 'monkey Feb 20, 2015 loves 2014 bananas'? 2014 and 2015 would both "pass" parse(), but only one of them is part of a date.
EDIT: there doesn't seem any reasonable way to deal with 'monkey Feb 20, 2015 loves 2014 bananas' That leaves 'monkey Feb 20, 2015 loves bananas' or 'monkey 2/20/2015 loves bananas' or 'monkey 20 Feb 2015 loves 2014 bananas' or other variants as things parse() can deal with.