I’m scraping information from an application and I have each time a string like “You have (400.65 points)”, but it can be also 34.90 or 4059.56, so I tried to scrap each time the number with a regular expression:
Your original expression would translate to something that doesn’t match your input:
From beginning of string match character 0 then - then one-or-more 9 then end of string.
Also the @ sign is not needed, that’s from C# to mark a string literal (to not need to escape special chars).
Hello nSangui, I guess we need more information. Please let me know why are you scrapping:
is it because it’s a citrix enviroment?
have you tried to use find relative image option when there is no selector available?
you can click on find image find the relative element of the value you are trying to get, for example “score” and then use relative reference to scrap the value.
Hi @andrzej.kniola, I use regex extensively for extracting data from non structured files, and to be honest it’s the only method I know. You said you are not a big fan of regex. I am curious what method do you use to extract data from non structured files, emails, etc ?
The environment where I’m working is a java application, and the complete sentence is “Career HSSE : (2345.65 point(s) HSSE)”, but UiPath identifies the section where the sentence is as an image.
I scrap because I want to extract this number to compare with another scraped from another application.
I extracted all the sentence and I’m trying to use the Regex to extract this double that changes every time (I need to compare some numbers), but I’ll also try the find relative one more time (I’ve tried, but didn’t work I think)
I have a followup-question: How do I use this type of expression in UiPath? (e.g. Regex.Match(somestring, @“\d+”).Value)
I have tried to use this directly in an Assign activity, but I am not able to run it:
If anyone is still looking for a solution, just use the activity “Matches” in UiPath, just as @andraciorici suggested.
As for the regex to be used for the above problem, use the following: “\b\d+.\d{2}\b”
Get Metric value:
Use Matches activity
Properties
Input : strvalue
Pattern : ((?<=Metric name:).*(?=ServiceName::))
Result: iEnumResult ->IEnumberable
after that use assign activity to get the data strMetric =iEnumResult (0).ToString()
@arivu96 hi . i wanted to ask you if i want to get all the matches and store them in an array of strings , how would i do that? For example: arrStrmetric = ? ;