Forum Discussion

mohan1921's avatar
mohan1921
Copper Contributor
Oct 03, 2022

SIT for DOB

As there is no out of the box template to detect the Date of birth in documents. Whats the best way to implement this? is there any custom regex available? is trainable classifier a good option?

  • Hi mohan1921 

     

    Thanks for posting your question here!

     

    These have been working for me. They should find it whether there is a “/“ “.” or “-“ between them. 

    dd-mm-yyyy

    (0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d

    mm-dd-yyyy

    (0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d

    yyyy-mm-dd 

    (19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])

    However, I haven’t found one that doesn’t catch invalid dates like February 31st or something.

     

    When you got to test it on regex101.com, make sure you set the flavor to .NET(C#).

     

     

     

     

Resources