Regex help for capturing date format

Hi team ,
Need help in creating regex format , I want to extract date from effective date

“Effective Date 2023-03-13”

I have created regex expressions like

(?<=Effective Date[\s*])([12]\d{3}-(0[1-9]|1[0-2]-(0[1-9][12]\d|3[01]))

But it’s not picking above date value , please let me know if am doing anything wrong ?

Regard
Krishna

Quick dirty:
grafik

Hi @Krishnakumar_Vasudevan
Use this regex in Find Matching Patterns activity

(?<=Effective Date\s)[\d\-]+

or use below syntax in Assign acxtivity:

strvar="Effective Date 2023-03-13"
Matches= System.Text.RegularExpressions.Regex.Match(strvar,"(?<=Effective Date\s)[\d\-]+").Value

Use this regex provided by you just made small changes to it:

(?<=Effective Date\s)([12]\d{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][\d]|3[01])

Hope it helps!!

Use this regex to get date

focussing on the date numbers part have a look here:

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

grafik

we guess there was just a pipe | missing
grafik

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