Currently, I am working on receipt scanning app. I need a date from an extracted text:
So the date format is fixed. So how can I use regx to extract date?
Currently, I am working on receipt scanning app. I need a date from an extracted text:
So the date format is fixed. So how can I use regx to extract date?
A simple RegEx to capture the dates in this format would be
/\s\d\d\/\d\d\/\d\d\s/
and then use String.prototype.trim()
to trim away leading and trailing whitespaces.
Using:
/\s[0123]\d\/[01]\d\/\d\d\s/
provides a little more validation, removing invalid months and days.