Hi All,
“Total payment of $1 on Tuesday will be credited to Test account on 12/12/22 ”
i want to get date 12/12/22. this date are in different format.
I have list of date format :- {“dd MMMM yyyy”, “dd MMM yyyy”, “d MMMM yyyy”, “d MMM yyyy”,“dd MMM yy”,“d MMM yy”,“dd-MM-yyyy”,“dd/MM/yyyy”,“dd/MM/yy”,“dd-MM-yy”}
Here On is the keyword after that date is present.
but on can be present multiple times
Gokul001
(Gokul Balaji)
September 26, 2022, 4:38am
2
Hi @TUSHAR_DIWASE
You can try with Regex Expression
System.Text.RegularExpressions.Regex.Match(YourString,"\d.{2}\S.{1,8}\d{2}").Tostring
Regards
Gokul
Gokul001
(Gokul Balaji)
September 26, 2022, 4:43am
3
HI @TUSHAR_DIWASE
Split Expression
Split("Total payment of $1 on Tuesday will be credited to Test account on 12/12/22").Last
Regards
Gokul
cant it be possible that we can check for “on” keyword and if date is present then only extract date otherwise go for next occurrence of “on”
Gokul001
(Gokul Balaji)
September 26, 2022, 4:49am
5
Yes @TUSHAR_DIWASE
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=on\s)\d.{2}\S.{1,8}\d{2}").Tostring
Regards
Gokul
2 Likes
Sanjit_Pal
(Sanjit Pal)
September 26, 2022, 4:50am
6
you can do like (?<=on).*\d.{2}\S.{1,8}\d{2}
1 Like
Hi @TUSHAR_DIWASE ,
I think the below expression will give you the most accurate results which you desire.
System.Text.RegularExpressions.Regex.Match(YourString,“\d{1,}.(\d{1,}|\S{1,}).\d{1,}”).Tostring
I hope this helps you!
Thanks & Regards,
Shubham Dutta
1 Like
thanks for the reply. it works as well for me along with above two solution.
thanks . you always help me in tight situation.
can you please be kind and explain me \s)\d.{2}\S.{1,8}\d{2} this
Gokul001
(Gokul Balaji)
September 26, 2022, 5:20am
10
HI @TUSHAR_DIWASE
(?<=on\s)\d.{2}\S.{1,8}\d{2}
\s -> Space
\d.{2} -> It will get the 2 number and the Delimiter
\S.{1,8} -> All character upto 1-8 words
1 Like
system
(system)
Closed
September 29, 2022, 5:20am
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.