Date Validation


#1

I have the date values as string like “1-Apr-17” in a data table. I want to get each value and check whether it is empty or not. If not empty, i want to check whether it is in the required format as “dd-Mmm-yy”. I tried to check with length like datevalue.length.equals(“8”) or datevalue.length.equals(“9”) in if condition. But it will be true if date value is in the format of “dd/mm/yyyy”. Please suggest any solution for this…


#2

Use below regex in Is Match Activity and pass your date variable.

https://regex101.com/r/fT7X6m/2


#3

regex is working fine. First one is for “1-Apr-17” and second one is for “23-Mar-17”. Can the second one be worked for both one digit day and two digit day?(1st and 23rd)


#4

I think first one regex with \d{1,2} is working fine for all one digit and two digit days


#5

I have the data of invoice stored in Excel.
How can i check if the invoice_date is valid or not?
I dont know how to use regex function.