How to extract only the date from a particular string which contains date and other invoice numbers. For Example consider" T-1234-22-04-2024" is the string I need to get output as 22-04-2024

Hi, I want to extract only the date from a particular string which contains date and other invoice numbers. For Example consider" T-1234-22-04-2024" is the string I need to get output as 22-04-2024. Your response is much appreciated

Hi @Aswin_Sutheesh17

Try this

image

\d{2}\-\d{2}\-\d{4}

Cheers!!

@Aswin_Sutheesh17

System.Text.RegularExpressions.Regex.Match(Input,"\d{2}\-\d{2}\-\d{4}").Value

Regards,

@Aswin_Sutheesh17
This works with any date format. delims(/ or -):

(3[01]|[12][0-9]|0?[1-9])(/|-)(1[0-2]|0?[1-9])\2([0-9]{2})?[0-9]{2}$

Just make sure if the you need to $ as it indicates the end of string.

Thanks :star_struck:

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