Extract data from Text


I need to extract Client information ie Client ID , Client Name, Client Country from the below text. Pls suggest how can we do that.

Client ID: UK18656
Client Name: Raymond Crider
Client Country: France

Buddy @callsaurabh

you can do like this buddy

if input text is of like this all three lines as a single text
do like this buddy

in_text = “Client ID: UK18656
Client Name: Raymond Crider
Client Country: France”

out_clientid = in_text.split(Environment.Newline.ToArray())(0).split(" ID: “)(1).ToString
out_clientname = in_text.split(Environment.Newline.ToArray())(1).split(” Name: “)(1).ToString
out_clientcountry = in_text.split(Environment.Newline.ToArray())(2).split(” Country: ")(1).ToString

or if its been obtained a separate line like this
in_text_clientid = “Client ID: UK18656”
in_text_clientname = “Client Name: Raymond Crider”
in_text_clientcountry = “Client Country: France”
do like this buddy

out_text_clientid = .split(in_text_clientid.ToString," ID: “)(1).ToString
out_text_clientname = split(in_text_clientname.ToString,” Name: “)(1).ToString
out_text_clientcountry = split(in_text_clientcountry.ToString,” Country: ")(1).ToString

Thats all buddy
try this and let know buddy
Cheers @callsaurabh

Buddy … I am gtting below error when trying to use the same.

String Str = Text.split(Environment.Newline.ToArray())(0).split(" ID: ")(1).ToString

1 Like

Kindly use a write line activity because i would like know how the get text is getting us the text from there,kindly add a writeline next to get text and share the screenshot of that buddy
that could easily help us to solve this buddy or copy that from output panel and paste it here buddy that be even easier
Cheers @callsaurabh


As requested. Pls suggest

1 Like

Try like this buddy @callsaurabh

out_clientid = split(in_text.split(Environment.Newline.ToArray())(0).ToString.Trim," ID: “)(1).ToString.Trim
out_clientname = split(in_text.split(Environment.Newline.ToArray())(1).ToString.Trim,” Name: ")(1).ToString.Trim
out_clientcountry = split(in_text.split(Environment.Newline.ToArray())(2).ToString.Trim,” Country: ")(1).ToString.Trim

Cheers @callsaurabh


Buddy … IT is still not working

Str = split(Text.split(Environment.Newline.ToArray())(0).ToString.Trim," ID: “)(1).ToString.Trim


It worked finally

Str = Text.Split(Environment.NewLine.ToArray)
ClientID = Str(1).Replace(“Client ID:”,“”).Trim

Thanks for your support.

1 Like

Thats great buddy…
Keep going
Cheers @callsaurabh

@callsaurabh use get text activity initially to get that value. Once you get that take assign activity in the value is pace give as outtext. Select({“:”, “Client”}, String split options.Removeemptyentries )and assign this value to a variable say strtext , you will as output as array of string. Use one more assign activity and in value place
Strtext(index number of one which you want). Trim+“-”+strtext(index number). Trim+“-”+strtext(index number). Trim
It will give you the required output