How to extract certain data fields from multiple pdfs

For example i have tried using inspect element to get just the TLS162 part but inspect element captures it combined. ( Invoice No.: TLS162 ). How do i extract just the TLS162 part and other data fields in a pdf?

Hi @zumaho

after extraction to get the required part use a split action like below

say your string is stored in str then str.Split({":"},StringSPlitOptions.None)(1)

or you can as well use replace st.Repalce("Invoice No.:","")

Check this on how to extract data from pdf

cheers

Hi @zumaho

Another approach using Regular expression

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=:\s)\S*$").Tostring

image

Regards
Gokul

hi @Gokul001

Do i copy paste this into the match activity directly, sorry no idea how to use Regex

Hi thanks for the reply. I watched the video and i think i get most of it other than how to come up with my own regex code thing.

What do you mean by this and where do i insert it into?

say your string is stored in str then str.Split({":"},StringSPlitOptions.None)(1)

or you can as well use replace st.Repalce("Invoice No.:","")

Hi @zumaho

This is how you use it

Directly in an assign

To paly with regex use this site

cheers

Hi @zumaho

You can use assign activity


what does this mean?

Hi @zumaho

str is the string variable where you read the pdf data. If you are reading the data into strpdf then use it.

And also in pdf you might have all fields so direct split on only colon might not work you have to use combinations or regex

cheers

(?<=Invoice\sNo.:\s)(.*?(?=\s))


i figured out the regex thing but why it is not working?

Hi @zumaho

Place the regex between inverted commas that field accepts only strings

For the output it is a matchcollection so it is like a collection of match variables

to get one value use ienMatch(0).Value this gives you the first identified value

if you want all identified values then use for loop like below

cheers

1 Like

HI @zumaho

Check out this XAML file

PDFAutomation.xaml (8.8 KB)

Regards
Gokul

1 Like