How can i get and seperate this text in 3 different variables from a website?

Here is the text.

image

I need the easiest way to do it :robot: :thinking:

Hi @170290064

First, use the Get text activity to extract the data and store in a Variable called Input_Str.

- Assign -> ClientID [String Datatype] = System.Text.RegularExpressions.regex.Match(Input_Str.toString,"(?<=Client ID:\s+).*").Value

- Assign -> ClientName [String Datatype] = System.Text.RegularExpressions.regex.Match(Input_Str.toString,"(?<=Client Name:\s+).*").Value

- Assign -> ClientCountry [String Datatype] = System.Text.RegularExpressions.regex.Match(Input_Str.toString,"(?<=Client Country:\s+).*").Value

Check the below workflow for better understanding,

Regex_Practice.xaml (14.7 KB)

Note : Check the output in the Immediate panel in the above image.

Hope it helps!!

1 Like

Hi @170290064

Can you try the below

inputString = "        Client Information Details

Client ID: HR70321
Client Name: Clement Paulette
Client Country: Romania "

clientId = inputString.Split({"Client ID:"}, StringSplitOptions.RemoveEmptyEntries)(1).Split(Environment.NewLine.ToCharArray, StringSplitOptions.RemoveEmptyEntries)(0).Trim()
clientName = inputString.Split({"Client Name:"}, StringSplitOptions.RemoveEmptyEntries)(1).Split(Environment.NewLine.ToCharArray, StringSplitOptions.RemoveEmptyEntries)(0).Trim()
clientCountry = inputString.Split({"Client Country:"}, StringSplitOptions.RemoveEmptyEntries)(1).Split(Environment.NewLine.ToCharArray, StringSplitOptions.RemoveEmptyEntries)(0).Trim()

image

Cheers!!

1 Like

@170290064

clientInfoArray = lines.Skip(1).Select(Function(line) line.Split(":")(1).Trim()).ToArray()

Use For Loop To get the Items or simply Use clientInfoArray(0)to get the first item,clientInfoArray(1) and so on

1 Like

@170290064
Assign: FirstVariable = Split(outtext.split(Environment.Newline.ToArray(),StringSplitOptions.RemoveEmptyEntries)(0),": ")(1).ToString

use for each activity

1 Like

@170290064

From website i guess you would get all data together

Then you can wither use split or regex to get the required data

Cheers

1 Like

Hey @170290064

For Client ID Use this in assign activity
yourclientidvar=system.text.regularexpressions.regex.match(yourintputfromwebsite,β€œ(?<=Client ID:)(.)*”).tostring

for client name

yourclientnamevar=system.text.regularexpressions.regex.match(yourintputfromwebsite,β€œ(?<=Client Name:)(.)*”).tostring

for client country

yourclientcountryvar=system.text.regularexpressions.regex.match(yourintputfromwebsite,β€œ(?<=Client Country:)(.)*”).tostring

image

image

image

Regards
Sreejith S S

1 Like

I hope you find the solution for your query… @170290064

If yes Make my post mark as solution to close the loop, else If you have any queries let us know.

Happy Automation!!

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