I am having issues capturing integers and dates correctly with regular expressions.
Integers
int_test: "Today is 6/28/2017 with 17.5 percent chance of rain"
int_pattern = re.findall(r'\d[0-9].*', int_test)
The problem I am having with this regular expression, it is capturing the the "6, 28, 2017, 17, and 5" from the int_test. I am not able to find a way to capture integers surrounded only by whitespace.
Dates
date_test = "Today is 6/28/2017 or June/28/2017 or 28/June/2017 or Jun/28/2017 or 28-Jun-2017"
date_pattern = re.findall(r'\d.*[- /]\d+', date_test)
For this one, I have already wrote code to support either "/" or "-" between dates. I have successfully been able to capture and digits before or after the "/" or "-", but I need a way to capture and amount of characters before or after the "/" or "-" in the sentence.
Any help would be greatly appreciated!