Hi Team,
i am trying to extract dates for a given string, the date could be different formats
i tried the following, but not getting dates… can you pls help
Version Date 2/27/2024 4:02:34 PM License Expiration 2024-08-27
(?<=Version Date )^d{1,2}\d{1,2}\d{2,4}
([0-3]?\d[-/\s:.*]*[JjFfMmAaSsOoNnDd][A-za-z]+[-/\s:.*]*\d{2,4})
1 Like
@devasaiprasad_K,
Try this expression.
\b(0?[1-9]|1[0-2])[\/\-](0?[1-9]|[12][0-9]|3[01])[\/\-](\d{4})\b|\b(\d{4})[\/\-](0?[1-9]|1[0-2])[\/\-](0?[1-9]|[12][0-9]|3[01])\b

Sample Code:
Outlook Demo.xaml (7.6 KB)
Output:

Thanks,
Ashok 
Anil_G
(Anil Gorthi)
3
@devasaiprasad_K
You can try this
\b(?:\d{1,2}[-\/.\s]\d{1,2}[-\/.\s](?:\d{2}|\d{4})|\d{4}[-\/.\s]\d{1,2}[-\/.\s]\d{1,2})\b
Cheers
vrdabberu
(Varunraj Dabberu)
4
Hi @devasaiprasad_K
A slight modification in your used regular expression would help.
(?<=Version Date )(\d{1,2}\/\d{1,2}\/\d{2,4}|\d{4}-\d{2}-\d{2}|[0-3]?\d[\-\/\s.]*[JjFfMmAaSsOoNnDd][a-zA-Z]+[\-\/\s.]*\d{2,4})
Regards
Hi @devasaiprasad_K ,
Try below pattern:-
\b\d{1,2}/\d{1,2}/\d{4}(?: \d{1,2}:\d{2}:\d{2} [AP]M)?\b|\b\d{4}-\d{2}-\d{2}\b
Thanks,
Jayesh