How to get client id,client name and client country from the client security hash assignment

Hello!

Yea, I tried this , i got the output as:

xxx xxxx
Address

I’m trying to remove Address parameter from this output.

Thank You.

yyaa its working

its working, thank you…

Very Good. Thanks

Hi Aishwarya, Good example

1 Like

Thank you :slight_smile:

1 Like

Hi Amit, did you get the resolution for this issue ? i am also facing the same issue.

Dont know if any one suggested scrape relative with native text or not, it is much easier

1 Like

Thank you Varun. It is working.

Thank you so much Sreekanth for your solution.

Its not working for me.
IndexOf ClientName is -1 and Indexof Client ID is also -1

Edit: Updated regex removes need for replace. Regex has been updated to: (?:: )(.*)((?:\r)|$)

I tried a different approach using a replace to get rid of carriage returns in the extracted text, and then a regex to match for each value. I’m not very good at regex but it worked in the end. Let me know if there is a better way to write the pattern or if you have question about my approach :slight_smile:

System1_ExtractClientInformation.xaml (10.6 KB)

1 Like

y u r using replace and matches activities .can u plz explain it

what is the function of groups. why u use groups ???
SplitStringMatches(0).groups(1).tostring

plz rply!!!

Edit: I was able to use a single regex match without a replace. This appears to be a more elegant solution :slight_smile: The updated regex is: (?:: )(.*)((?:\r)|$)

Hi @SowmiyaSowmi,

I used a replace and match instead of substrings. The assignment didn’t specify what method of manipulation you’d need to use so I decided on these because in my opinion they are more reliable if the text changes (substring may fail if the length of the string or words change).

If I knew how to write Regex expressions better I could’ve done it all using matches and not needed the replace. But, I’m still learning :slight_smile:

Basically, the reason I had to use groups was because the match returned two groups and only one had the content I wanted. There is a good explanation of Regex groups here: regex - What is a non-capturing group in regular expressions? - Stack Overflow

For example:
Match expression in my sample project was (?::\s)(.*)

Example input:
Client Id: 12345
Client Name: AdamW

Output:
Group 1: “: 12345”
Group 2: “12345”

As you can see, group 2 is what I need. Because the language in UiPath starts at 0, I needed SplitStringMatches(0).groups(1).tostring to get the right result.

You can play around on this site with Regex and make you’re own: https://www.debuggex.com/

Here is a sample of what you can try with my example above:

Hopefully this helps :slight_smile: Let me know if you need more information.

1 Like

System1_ExtractClientInformation (1).xaml (10.2 KB)

error

can u please help me to solve this!!!

tqsm for your explanation.this s the first tyme i am using regrex

Hii @megharajky
what is the variable type of dataTogetHash???
its still not working for me.please help me to find out the error.
thanks in advance

How are you running the file? Are you working on this as part of the assignment from the training? Have you changed anything from the file that I originally provided?

What this error usually means is that the value is blank or empty when you are doing the “Assign - Client Id”. Try running the project in debugging mode and see what you are getting for your local variables when running.

1 Like

@Amit_Malik Hi, Below code is working well for me

Client ID:- P.Split(“:”,“Client”)(2).ToString
Client Name:- P.Split(“:”,“Client”)(4).ToString
Client Country:- P.Split(“:”,“Client”)(6).ToString

“P” is the output of Data Scraping activity.

1 Like