Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in RPA by (12.7k points)

I am trying to validate date which is coming from an excel sheet , the format should be in dd/mm/yyyy i tried with regex pattern [0-9]{2}/[0-9]{2}/[0-9]{4} but this won't work with single-digit date and we since we cannot add 0 at start in excel sheet this pattern ain't working. (this is for blueprism tool which has an action for regex matching)

1 Answer

0 votes
by (29.5k points)

Hi, try using the regex given below it takes many date format into account as well

^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[13-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$

Related questions

0 votes
1 answer
asked Jul 29, 2019 in RPA by noah kapoor (5.3k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 29, 2019 in RPA by noah kapoor (5.3k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

29.3k questions

30.6k answers

501 comments

104k users

Browse Categories

...