Regex query help

FW: DO33 – SMR – Tianjin –October – 2022
i have this expression i want tianjin
FW: DO33 - SMR - Mexico - October - 2022 in this want mexico
so pls tell me the expression of this if gap is there or not it will gave me that after SMR ANY VALUE

HI @Kuldeep_Pandey

Check out this expression

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

image

Regards
Gokul

HI @Kuldeep_Pandey

Try with this updated Regex expression

YourString = "FW: DO33 – SMR – Tianjin –October – 2022"
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=FW:\s\S+\s\W\s\S+\s\W\s)\S+").Tostring

image

Regards
Gokul

Not working

Same error not giving site name

Have you tried with this expression? @Kuldeep_Pandey

Share some screen shot and tell what is not working? Don’t tell just like that Not Working

Share the correct input with us? @Kuldeep_Pandey If your Input is correct it will work

Check out this sample input

If the input is different we need to update the expression

image
Its not giving tianjin

FW: DO33 - SMR - Hyosang - October - 2022
FW: DO33 – SMR – Tianjin –October – 2022
FW: DO33 - SMR - Mexico - October - 2022
FW: DO33 – SMR – Bursa – October – 2022
now pls tell me the exp for this after smr all site name how to get

HI @Kuldeep_Pandey

Try with this expression

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

image

I think so you have two space in-between the FW: & D033

Regards
Gokul

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