Get Specific words from a text

Hey,
I am working on an automation which should get a specific text from a pdf file. I use the “Read PDF Text” Module. The output looks like this:

Some random company information 21414 - 213
More info
Serialnumber: 13232
Street 23
Date: 19.04.23
Price: 213€

How can I only get the Serialnumber and Date from the text?

Hi @hanikf

You can use the following RegEx patterns to extract the desired data:

Serialnumber:\s*(\d+)

image

Date:\s*(\d{2}\.\d{2}\.\d{2})

image

UiPath Syntax:

System.Text.RegularExpressions.Regex.Match(yourString,patternStrin).Value

Edit: Output -

Hope this helps,
Best Regards.

Hi @hanikf ,

For serial number:

System.Text.RegularExpressions.Regex.Match(inputText, "Serialnumber:\s+(\d+)").Groups(1).Value

For Date:

System.Text.RegularExpressions.Regex.Match(inputText, "Date:\s+(\d{2}\.\d{2}\.\d{2})").Groups(1).Value

Regards,

@hanikf

Try as below

Same as for Date

Hope this may help you

Thanks,
Srini

Hi @hanikf ,

Welcome to the community,

You can also use the split function for string.

image
image

Thanks

Thanks for the helpful and quick replies.
I was able to fix my automation.

2 Likes

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