Help with text extraction - System1 - ExtractClientInformation

Hi team,
I need help with extracting information from a webpage.

duvida%2C%2C

I need information from: Client ID, Client Name, Country Client. separately

I was able to get here and I can not go forward to extract the other information
test

ystem1_ExtractClientInformation.xaml (13.4 KB)

Please,
can someone tell me the direction or if there is any other way to do it.

2 Likes

Hello @KMota

Try use the Extract Structured Data Activite and as output get a DataTable

image

Hello @dkollyns

Thank you for the answer, but I believe that in this way I can not continue the activity. Maybe I did not express myself well. I need this information to finish the activity of the uipath academy, after extracting this information they will be inserted in another web page. I was able to extract it, but it is not correct.

you will need to use string manipulations :slight_smile:
Here is a solution to your question in a similar thread

2 Likes

Hi @nadim.warsi

Yes correct. I’m following a tutorial and was explained about string manipulation, but otherwise. I’ll try to use your tip (although I did not understand it very well :disappointed_relieved: but I’ll try first and if I can not I’ll scream :rofl: :rofl:

1 Like

Let me explain it

You have this
image

Your variable is a string with new lines and empty spaces.
Hence:

  1. Use yourvar.Split(Environment.NewLine.ToArray,StringSplitOptions.RemoveEmptyEntries) - to remove the new lines characters and empty spaces.

Output of this will be “ClientID: LUJ23971,Client Name: Chance Strittmatter,Client ID: PU23971” which is an array of strings say “yourarray”

To get values from array using index you do this and then take the value after “:” split again and the use idex again :slight_smile:

yourarray(0).Split(":"c)(1).Substring(1) which is your ClientID

so
yourarray(1).Split(":“c)(1).Substring(1) is Client Name
yourarray(2).Split(”:"c)(1).Substring(1) is Client ID

7 Likes

You can either the easier solution provided by @nadim.warsi (which is what I opted for), or you can use a RegEx expression to pull it with the ‘Match’ expression… but you would need to first format your output to a single line string for easier processing.

Remove line breaks with: yourString.Replace(Environment.NewLine,":") - The “:” will be what goes in place of the line breaks in the new string, which makes it easier to pull out values with RegEx as each variable will broken up by a “:” character. You can use any character in place.

Next, use the Match regex function System.Text.RegularExpression.RegEx.Match(input,pattern).Value to get the variables. Here is the first expression to get the Client ID:

System.Text.RegularExpression.RegEx.Match(yourString,"(?<=Client ID: )(.*)(?=:Client Name)").Value

To explain, the positive lookbehind “?<=” expression tells the expression to locate the Client ID: section and look at what is behind it. We’ll grab all the text using “(.*)” which grabs any characters behind it (ignoring line breaks), but we need to ensure we don’t take all the rest of the string so we’ll need to cut it off at a point. We can do that with the positive lookahead “?=” expression which will match anything in the group before it without taking the text contained in lookahead.

You can then apply this same strategy to the others to get the variables as needed. This is just an alternative method to the one outlined above which uses an array to grab each individual variable.

2 Likes

now it’s clearer :smile: . I’ll test and tell you if it worked.
Thank you

1 Like

Hi @Jon4than

Thanks for the contribution, I’ll test it too. Thanks

Hello guys,

Thanks for the help, now I can continue the activity, after several tests with the previous tips I got the solution. I’ll post if anyone needs help in the same case as me. The learning continues, thank you.

4 Likes

Hi,
Use get text activity. Then split the result using environment.newline
Now u will get 3 results clientid:value as first client name:value as second one like so later split with : then u will get values what u deserve.

For example : the get text activity storied in strtextvalue.
Split(split(strtextvalue,environment.newline)(0),":")(1)
This will give client id value
Split(split(strtextvalue,environment.newline)(1),":")(1)
This will give client name value.
Split(split(strtextvalue,environment.newline)(2),":")(1)
This will give client country value.

3 Likes