Help in Regex string Manipulation

HI All,
I need help in regex

input: "Total payment of xxxx will be credited to Test’s account on vsnk. Thank you.Total payment of xxxx will be credited to Test’s account on 12 September 2022. Thank you. "

i need date i.e 12 September 2022. Their is no fixed string so cannot use look ahead and look behind.
only fixed string is “on” before date. Also date can be in 12th September 2022 format.

thanks

Hi @TUSHAR_DIWASE

Take a look at this Regex pattern.

It doesn’t rely on any look aheads/behinds but could add the “on” if needed.

Cheers

Steve

2 Likes

Hi @TUSHAR_DIWASE

How about this expression

System.Text.RegularExpressions.Regex.Match(YourString,"\d.{2}\S.+\d{4}").Tostring

image

Regards
Gokul

@TUSHAR_DIWASE
Try this
\d{2}\s\D+\s(?=\d{4})\d+

System.Text.RegularExpressions.Regex.Match(YourString,"\d{2}\s\D+\s(?=\d{4})\d+").Tostring.Trim

image

1 Like

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