hanikf
1
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+)
Date:\s*(\d{2}\.\d{2}\.\d{2})
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,
Hi @hanikf ,
Welcome to the community,
You can also use the split function for string.
Thanks
hanikf
6
Thanks for the helpful and quick replies.
I was able to fix my automation.
2 Likes
system
(system)
Closed
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.