I would want to fetch a pdf value with below format. How can i fetch that?

Name : Age: Class :
Thrippoorani 12379-128310 Property1

Hi @Poorani_Ramachandran

welcome back to forum

Use read pdf activity to read the pdf

use regex to extrct the required data u need

Regards,
Nived N
Happy Automation

Is there an xaml sample that you can show ?

Hi @Poorani_Ramachandran !
So that we can help you with a xaml, we would need a sample data of your pdf :grin:
Would you mind sending it to us ?

Name.pdf (43.2 KB)
Attached is the sample data. I would like to fetch the value of name, age and class./

Hi @Poorani_Ramachandran !
So you need to use regex as we said, here is an example.
So you need to use:
image
then you can try several regex like the following:

I think that @prasath17 would help greatly on regex, or @mohammedsameer.ali1

The text obtained after getting from read pdf activity:

"Name :                                                      Age :                                                               Class:

Thrippoorani                                         82377-2323                                                 Property3"
1 Like

Hi @Poorani_Ramachandran - You can fetch all these values in one shot…

Regex Pattern Link

StrMatches = system.text.regularexpressions.regex.matches(StrInput, "(?<Name>\w+)\s+(?<Age>\d+-\d+)\s+(?<Property>\w+)")

Here StrMatches is of variable type MatchCollection and StrInput is your ouptut from ‘Read PDF Text’ activity…

You can assign 3 variables as shown below…

Name : StrMatches(0).groups(1).tostring
Age : StrMatches(0).groups(2).tostring
Property : StrMatches(0).groups(3).tostring

Hope this helps…

1 Like

Hi Prashant,
looks like its detecting the incorrect output.
Could you help me with this ?

Hi Hiba,
Looks like the solution is not working at my regex.
Could you help me with this.

Hi Prashant below is my comment regarding the solution.

@Poorani_Ramachandran …yes because solution was provided for the pdf you provided…and you are trying it on totally different text…thats why it is not working

@Poorani_Ramachandran - For the attached screenshot , please find the below regex…

Note: Regex pattern(s) only works if the pattern remains the same. You cannot use the pattern from one regex to others without tweaking. So please make sure your requirement is correct.

HI Prashant
Noted and thanks on requirement.
The solution seems to be working. Will raise if encounter any issues.

1 Like

@Poorani_Ramachandran - Glad to know. Please mark my post as solution, that will close this thread.