0

Currently, I am working on receipt scanning app. I need a date from an extracted text:

enter image description here

So the date format is fixed. So how can I use regx to extract date?

7

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.