Substring of Get Text

I have to extract information from a web page. I am using get text , and I need to make a substring of the following text string (57 registered candidates), I need to extract the number “57” and save it in a variable. But that number could be 1 digit, 2 digits or 3 digits, so the substring must be able to capture the number regardless of its digits.

Hi @Julian_Torres_Torres

\d+

image

image

Hope this helps!!

Hello. How could I do that, what you are showing from “Expression”.? Thank you so much

@Julian_Torres_Torres

System.Text.RegularExpressions.Regex.Match(Input.ToString,"\d+").Value

@Julian_Torres_Torres

You can try this way also

Hi @Julian_Torres_Torres

Try this:

inputString= "57 registered candidates"
extractedNumber= inputString.Substring(0, inputString.IndexOf(" "))

or

inputString= "57 registered candidates"
outputString= System.Text.RegularExpressions.Regex.Match(inputString,"\d+").Value

Hope it helps!!

Hi @Julian_Torres_Torres

After using GET TEXt and extracting the string
You can use this expression
Text.Substring(Text.IndexOf(“(”) + 1, Text.IndexOf(" registered candidates") - Text.IndexOf(“(”) - 1)

Hope this helps!!

Regards,
Gayathri M K

Hope you got the solution for your question @Julian_Torres_Torres

If yes please mark it as solution to close the topic.

Try this it will match all digits in your text string.

@Julian_Torres_Torres

After getting the string value from Get text activity
Use Find Matching Patterns activity give the input variable in Text to search in option in properties panel
Click on configure Regular Expression In RegEx column change to Advanced and In value column add the following :
/[0-9]+
click save
To store the output create a variable and assign it in Result option in properties panel
Use this code to get the exact value in string format
OutputMatches(0).value
where OutputMatches is the output from Find Matching Patterns activity

image
image


image