Getting part of text from screen scrape result

Hi community!

I need to get an application ID from a website where we file applications. You can’t select just that line as an element, it only takes the whole block. So I used screen scrape to get the full text. Now I want to only isolate that Application ID.

The wording might not always be the same, so I can’t use the number as length to trim.

Is there a VB expression that will let me trim all the extra text and leave me only with the x number of characters following “Application ID:” ?

Text example:

What Happened: Completed application was successfully saved and any files chosen have been successfully uploaded.
Application ID: 1321564ABVKA
Date: July 05, 2019
Current Status: Awaiting Payment

Thank you!!

@JCH

Try this:

PdfText.substring(pdfText.IndexOf("Application ID: ")+"Application ID: ".Length).split(Environment.NewLine.TocharArray)(0)

Where pdfText is your input text.

You can try using regex.
Check https://activities.uipath.com/docs/matches
and build your regex something like https://regex101.com/r/0RDVpj/1

(?<= ID: )(.*)

image

use this in matches activity this will return you the ID

Fine
if the input string is saved in a variable of type string like
str_input = “What Happened: Completed application was successfully saved and any files chosen have been successfully uploaded.
Application ID: 1321564ABVKA
Date: July 05, 2019
Current Status: Awaiting Payment”

Then the output would be like this
str_output = Split(str_input.Split(Environment.Newline.ToArray())(2).ToString.Trim,“ID:”)(1).ToString.Trim

Cheers @JCH

Thanks @RobertD and @ashley11,

Your answers seemed to work best. I’m still trying to learn Regex…

I was trying to remove all personal information from the example I gave. That included a name in brackets, which I want to exclude as well. But those brackets seem to mess with the regex.

So it would be something like the below. How can I modify the regex so that it will also exclude “(my name)”?

What Happened: Completed application was successfully saved and any files chosen have been successfully uploaded.
Application ID: 1321564ABVKA (my name)
Date: July 05, 2019
Current Status: Awaiting Payment

3 Likes

Thanks @ashley11
And thanks everyone for your quick responses. Spent 3 hours trying to figure this out… :tired_face:

1 Like

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