Extract all the Date of the form "22-MAR-2020" from a string

Need to extract all the dates of the form “22-Mar-2020” from a string. Can anyone provide the regex to extract and then to convert in “2020/03/22”?

@alpharobot
date format conversion is done preferable with parsing into a datetime and then output it with a reformated string representation instead of doing it on string base

For this conversion have a look here:
grafik

ensure following:
grafik

2 Likes

Thanks forthe reply @ppr

But how to get all the dates in the form of “dd-MMM-yyy” from a string?

what does mean “all” dates.

Just elaborate more on your process and requirements. What is to do, from where comes the input for the bot, how is the input defined.

Thanks

1 Like

@alpharobot Use \d{2}-[A-Z][a-z]{2}-\d{4} to extract all the dates of the form “22-Mar-2020” from a string and use @ppr answer to get them converted into the desired date format

1 Like

Thanks, @Arpit_Kesharwani it worked fine.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.