How to take month folder in text subject

FW: DO33 – SMR – Bengaluru – June – 2022
i have to take june

HI @Kuldeep_Pandey

You can try with regex

System.Text.RegularExpressions.Regex.Match(YourString,"January|February|March|April|May|June|July|August|September|October|November|December").Tostring

image

Regards
Gokul

And i want to take site name also
like bengaluru

HI @Kuldeep_Pandey

System.Text.RegularExpressions.Regex.Match(YourString,"\S+(?=\s\W\sJanuary|\s\W\sFebruary|\s\W\sMarch|\s\W\sApril|\s\W\sMay|\s\W\sJune|\s\W\sJuly|\s\W\sAugust|\s\W\sSeptember|\s\W\sOctober|\s\W\sNovember|\s\W\sDecember)").Tostring

image

Regards
Gokul

FW: DO33 – SMR – Bengaluru – June – 2022
FW is always there in subject

What do you mean? @Kuldeep_Pandey

Check out the output

image

Regards
Gokul

HI @Kuldeep_Pandey

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=FW:\s\S+\s–\s\S+\s–\s)\S+").Tostring

image

HI @Kuldeep_Pandey

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=FW:\s\S+\s–\s\S+\s–\s\S+\s–\s)\S+").Tostring

image

Regards
Gokul

How to take year?
From subject

HI @Kuldeep_Pandey

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=FW:\s\S+\s–\s\S+\s–\s\S+\s–\s\S+\s–\s)\d+").Tostring

image

Regards
Gokul

(?<=FW:\s\S+\s–\s\S+\s–\s\S+\s–\s\S+\s–\s)\d+")
Can u tell me the meaning for this

Here \s & \S

image

\d

image

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