I’m posting to validate a regular expression I have generated using this regex builder. I’m trying to search a string to see if it contains a date in the UK format dd/MM/yyyy.
The expression I generated is: [0-3][0-9](?:\/)[0-1][0-9](?:\/)[0-2][0-9][0-9][0-9]
It seems to work so far but I’m sure this can be improved on as I have limited experience with regular expressions. Any input would be appreciated, thank you.
FYI, If you want to check strictly whether date string is valid, perhaps you should use IsDate function. For example, it can return exact if result 2/29 is valid or not, checking leap year.
Thanks, I will be reading a field where a date should be entered (but accepts any freetext) so I want to make sure there is a valid date in a proper format as I need to use it later in the process.