1
We can find some difference when using re.Compile inside Python?
Assuming a file with 10 lines composed by dates and a file with 10,000 lines of dates.
A Pattern could be pattern = re.compile(r'\d{2}\/\d{2}\/\d{4}')
and the second only the match
re.match('\d{2}\/\d{2}\/\d{4}', 'variavel_para_arquivo')
Perhaps because of
re.compile
return an object, you can reuse it in to check other strings.– Wallace Maxters
About
re.compile
, the duplicate suggested above already explains well. About using regex for dates, I suggest a read here: https://answall.com/q/3660/112052– hkotsubo