Regex Based Information Extraction

Hi Team,

Using Read PDF text i am extracting data froma PDF and pasting it into a Text File.

It has some Amount infomation which is getting Extracted as

image

I want to get this amount I have used the following Expression but it isn’t working :

System.Text.RegularExpressions.Regex.Matches(Txt, “(?<=\sTotal\s*₹ )\d+(,|.)\d+(,|.)\d+”)(0).ToString

Can anybody Help me Rectify This ?

The Original Text File :
1.txt (647 Bytes)

I need to extract the value which is exactly below the Total Column like in the picture I have mentioned

Hi @Ishan_Shelke

System.Text.RegularExpressions.Regex.Match(Txt,"?<=Services- VD Subsidy(\s).*[\d].\d+\s)\d+\,?\d+\,?\d+\.?\d+").Value

Hope it helps!!

Hi,

You can try this,

This expression should return the total amount as a string.

System.Text.RegularExpressions.Regex.Matches(Txt, “(?<=\sTotal\s*₹ )\d+(,|.)\d+(,|.)\d+”)(0).Value

HI @Ishan_Shelke

you can try this way both match and matches in regex

  1. Match
    System.Text.RegularExpressions.Regex.Match(str_Input,“[0-9]+(,|.)[0-9]+(,|.)[0-9]+(,|.).\d{2}”).Value

  1. with matches you can cal with index

System.Text.RegularExpressions.Regex.Matches(str_Input,“[0-9]+(,|.)[0-9]+(,|.)[0-9]+(,|.).\d{2}”)(0).ToString.Trim

Hi @Parvathy ,

image

I am getting the following Error While Running

Hi @Ishan_Shelke

Make sure you can given the syntax correctly.

Regards

Hi @Ishan_Shelke

you can try this Regex Expression

str_input=“YourText”

System.Text.RegularExpressions.Regex.Match(str_input,“\d{1,3}(,|.)\d{1,3}(,|.)(\d{1,3})(,|.)(.\d{2})”).Value

output :-

1 Like

Hi @Ishan_Shelke

Use this in Assign Activity
Save to: Output
Value to Save: System.Text.RegularExpressions.Regex.Match(Txt,"?<=Services- VD Subsidy(\s).*[\d].\d+\s)\d+\,?\d+\,?\d+\.?\d+").Value

Output variable is of DataType is System.String

Hope it helps!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.