Extract only middle word from a string

#1

Hi guys,
i have a string below and I want to extract only “ON” from the string.
Can someone help in this.

1-8200 DIXIE RD
BRAMPTON ON L6T0C1

#2

Hi @somya177,

Kindly check the example attached and let us know if it helps you.

Main.xaml (6.1 KB)

Thanks.

#3

apart from Brampton,it can be any other city like Quebec BC L6T0C1
how will the BOT then pickup “BC” from it?..

#4

Hi @somya177,

Also, please check this one and test it. It’s using Regex and the string on this example is also the same from your example.

Main.xaml (5.9 KB)

#5

Please test the two .xaml files that I sent to you and let us know which one has solved most of your scenarios.

1 Like
#6

thank you very much…it’s working…:slight_smile:

1 Like
#7

so second one worked better but the concern is that currently the address is this, but i believe better approach would be to pick up “ON”,“BC”,“WB” from the last.
Because the last is the Pincode which will always be constant 6 letters and before the PINcode will always be this Province code of 2 letters and will always be the same.
Provincecode space Pincode.
So can’t we use any kind of substring and pick the province code from the last as their positioning will never change

#8

Hi @somya177,

I totally agree with you and in order to achieve it you could use the following code:

matches.ToList(matches.ToList.Count -2).ToString

#9

it needs to be in assign activity or after the ismatches activity?

#10

After the IsMatches.

1 Like
#11

ok…thank you very much…:slight_smile:

1 Like
#12

How about this?
WR-4165688061-CTR
I just need the middle 10 digit number between WR and CTR.
can you please help in extracting this?

Regards

#13

Sure, please check it below:

Main.xaml (5.8 KB)

:slightly_smiling_face:

2 Likes
#14

Hi @somya177,

This is another way… Hope will help you,

Cheers…!

1 Like