Regex question help

Hi,
Need help with this.
I need to capture the date (May 15, 2023) in the following.
Time can be anything 10:30 AM or 3:15 PM etc.
I do not need to get Billing Date.

Signed by Martha Garg at 2:55 pm, May 15, 2023 Billing Date: 5/25/2023.

Many Thanks,

Hi

How about the following?

System.Text.RegularExpressions.Regex.Match(strInput, "\b(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{1,2},\s\d{4}\b").Value

Regards

1 Like

Thanks a lot @fernando_zuluaga

1 Like

Hi @A_Learner ,

Maybe could also be shortened to the below by anchoring to Billing Date keyword assuming it will be present always :

\w+\s\d{1,2}\,\s\d{4}.*(?=\sBilling Date)

Thanks! @supermanPunch

1 Like

Hi, @supermanPunch

How does the above regex change, if it can be

Signed by Martha Garg at 2:55 pm, May 15, 2023
or
Signed by Martha Garg at 2:55 pm, May 15, 2023 on some extra text

Many thanks!

@A_Learner ,

Maybe the below modified Expression satisfies your criteria :

\w+\s\d{1,2}\,\s\d{4}.*(?=\sBilling Date|\n)

Visuals :

Wow! Thanks! @supermanPunch

1 Like

This is matching any words other than Signed by.
How to change this Regex to exactly match the sentence starting with Signed by.

\w+\s\d{1,2},\s\d{4}.*(?=\sBilling Date|\n)

Thanks for the help.

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