Regex based extractor extracting all value from all the pages of the pdf

Hi @Gokul001
This is the field I want to extract!

Screenshot 2022-03-09 104213

This is the regex builder where I am typing the regex you mentioned!

Hi @shrey.shah

In the Value Just give the Regex Patten

Regards
Gokul

Hi @Gokul001
That is what I was doing previously as shown below:

But this is returning value from all the pages of the pdf. I only want the value from the first page!

If possible share the Input @shrey.shah

@Gokul001 By Input you mean the pdf files?

Yes @shrey.shah

Hi @shrey.shah

Have you try with selecting the option in the drop down

Check → SingleLine

Regards
Gokul

1 Like

@Gokul001 Yes it is working now. So Singleline basically extracts only the value from the first page?

Great @shrey.shah

Only for the particular Regex pattern you can use Singleline

If your Query is resolve Kindly clos this topic by marking solution. So it will help for others too.

Regards
Gokul

@Gokul001 Thanks a lot!

Great @shrey.shah

Happy Automation

Regards
Gokul

@Gokul001 Sorry to disturb again but if I select the Singleline option, then along with the amount it is also extracting other details in the page as shown below:

I tried limiting the characters but then it again extracts the value from all pages even with Singleline selected:

Hi @shrey.shah

In this case use use string manipulation to extract the particular amount.

Can you share the data after extracting from the regex extractor.

Regards
Gokul

@Gokul001 I have uploaded the image of the data extracted for both the scenarios (Singleline+no character limit) and (Singleline + character limit) in my previous reply

Hi @shrey.shah

Just drop here in text format after extracting with singleline

Regards
Gokul

@Gokul001 I have uploaded the excel files

Hi @shrey.shah
Instead of writing in Regex Builder for getting the Amount

You can try to use Assign activity

System.Text.RegularExpressions.Regex.Match("Inputstring","Rs.\s(\d.+)").Groups(1).Tostring

Regards
Gokul

@Gokul001 But what should I write instead of “Inputstring”?

Have read the PDF in the beginning of the process?

If not , Use Read PDF activity Store the value in the variable.

Pass that variable in the expression

Regards
Gokul

@Gokul001 It is giving error “Argument text: unrecognized escape sequence”. I am using C# as the language