Comparing recognized text with date format

Hello! My robot recognizes text in formalized PDF documents. Copies it to the variable “doc_text”. In “doc_text” it searches for a date (always between two same words), writes to the variable “doc_date” with type “String” and inserts it into the internal system. Sometimes the date is not read correctly. When you try to insert an incorrect date into the system, a crash occurs, the date field is required.
To avoid errors, I need to compare the date from the recognized text with the date format DD.MM.YYYY and if the recognized text is not in the DD.MM.YYYY format, then replace it with the current date.
How can i do this?
Thank!

1 Like

Hi @Nataliya_Zotkina you can check if a string matches a specific format by using the condition “matches regular expression” in the If-Else action.

I think the regular expression for your case will be ^([0-2][0-9]|(3)[0-1])(\.)(((0)[0-9])|((1)[0-2]))(\.)\d{4}$

Thank you very much for your help! Works great!

1 Like