'deep learning OCR model predicts date with different every time

I am working on the OCR model which is based on deep learning. I want to hide important information in a document. Date of birth is one of the things. The OCR model recognizes the date but the format is different.

How I can handle all scenarios?. There are many scenarios like those below

OCR Model Output

- 2020 O5 25
-2020O525    
 2020 O5 25

Code

pattern_8 = r'-\d{8}'
pattern_4 = r'-\d{4}'

 elif re.match(pattern_8, xx) or re.match(pattern_4, xx):
                    print("Date Found", str(xx))


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source