Help extracting Specific portion from String

I am attempting to extract the bold value from this example string.
I used Split("/“c)(0) and then Split(” ") to separate the string up but I can’t seem to navigate any further than that.

Unsure how to display the second to last value from that string, as the address "Montague Lloyd can vary the number of spaces present.

> M100002 SAMPLES Montague Lloyd, United Kingdom 27.00 Active 22.50 30/10/2020 1 ***** TRAINING - Unico Limited ***** 128 - ML Telesales - Calls

Anyone got a god approach to this sort of string split activity

Hi @LewisHenderson

Which part u need to get

I am not clear with that

@LewisHenderson - Hope this helps…

image

StrMatch=System.Text.RegularExpressions.Regex.Matches(“M100002 SAMPLES Montague Lloyd, United Kingdom 27.00 Active 22.50 30/10/2020 1 ***** TRAINING - Unico Limited ***** 128 - ML Telesales - Calls”,“[0-9.]+(?=\s\d{2}/)”)

StrMatch is of variable type = Match collection

image

Output:
image

2 Likes

Regular expression is the recommended way to extract information from a text. But if you prefer to use Split(), you can get the second last value by reversing the array and then selecting the second value:

secondLast = myString.Split("/"c)(0).Split(" ").Reverse()(1))
1 Like

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