I am having an issue grasping the best way to do what the title suggest. I want to extract Product Names (lines) and corresponding prices from a PDF, whereafter the goal is to multiply all of these corresponding prices with some number (a logistics cost) but without using OCR…
i need by Regex
How do I tell UI Path to take the numbers next to the product names (AND NOT any other number)?
Thank you for your time!
Best regards,
Priyanga
Hello @Priyanga_Karnan and welcome to the community.
First you need to read the PDF file and understand what your text looks like in UiPath.
Step 1:
CLick on Manage Packages in UiPath.
Find this package in the official package section: UiPath.PDF.Activities
![image](https://global.discourse-cdn.com/uipath/original/3X/e/f/efe6eab4bc815fd07a92bc3bc605062d0fbfad71.png)
Use a Read PDF activity.
![image](https://global.discourse-cdn.com/uipath/original/3X/c/d/cd86143d1acc927a3a4b1014d04f69f5c8185983.png)
Then use a “Write Line” activity - export the result into notepad. Keep it handy.
Step 2: Learn Regex or Make a Post
Be sure to include:
- A sample (notepad file from step 1)
- Highlight the expected OutPut
- Tell us about the Pattern of the text.
(If you do this you will have a robust Regex Pattern in likely less than an hour or two).
Check out my Regex New Users MegaPost to learn about Regex.
You will need to use a Matches activity (or Assign) to get the result into the desired string variable ready to insert into your process.
I hope this helps.
Plenty of gurus on the forums.
Cheers
Steve
1 Like
I have to extract the details like Product, description, Quantity and Price from the PDF file.
i need to extract using the regular expression
can i have code for Product
Input -Product
output - A339937
Hey
Happy to help
THank you for providing the outputs. But we will need a Sample.
Once you have it in UiPath ->Click OutPut ->Click he logfile image (red circle) then upload the file or paste the contents here.
Then we can get you a Regex Pattern.
Hi @Priyanga_Karnan
Can you provide the text file in which you Write the data from PDF using Read PDF Text Activity ?
Happy Automation ![:raised_hands: :raised_hands:](https://emoji.discourse-cdn.com/twitter/raised_hands.png?v=12)
Best Regards
Er Pratik Wavhal ![:robot: :robot:](https://emoji.discourse-cdn.com/twitter/robot.png?v=12)
![:computer: :computer:](https://emoji.discourse-cdn.com/twitter/computer.png?v=12)