How to find index of the words

image
I Want to find all the word after Smr- so i how i can do this

not all the word only chongqing , tianjin ,xizhou , istanbul

Hi @Kuldeep_Pandey

U can use this if you want Full Text after SMR

Yourstring.substring(yourstring.indexOf("SMR")+("SMR- ").Length.trim

if you want Only Specific after “SMR”
you can use this Regex Function

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

Thanks
Harivishnu

HI @Kuldeep_Pandey

You can try with regex expression

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

Regards
Gokul

Which Activity you used for this

Hi @Kuldeep_Pandey

Use Assign activity, Check out the image

Regards
Gokul

Its not creating only last folder iatanbul i dont know whats the problem its creating all 3 but not 4

Can you share the File name of the 4th file @Kuldeep_Pandey

Hi @Kuldeep_Pandey

Try with this expression

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

Regards
Gokul

its not working
I read 4 Subject heading again there is one space more than all 3 subject after smr

Hi @Kuldeep_Pandey

Try with this

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

HI @Kuldeep_Pandey

Checkout this

Split("DO33 - SMR - Chonging - September - 2022","-")(2).Trim

image

Make sure that the symbol “-” matches with the one you have in the string it seems like the “-” length slightly big than the normal “-”

Regards
Sudharsan

HI @Kuldeep_Pandey

Try with this expression

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

Check out the Output

image

Hello @Kuldeep_Pandey

Hope you are trying to get the file names of the attachment. So you need to loop through the email attachment names and then use the string manipulation to get the names. To get the names you can do as below.

Split(attachment.Name,“-”)(2)

where attachment.name gives you the names of attachment in the loop.

Thanks