Extraction Net Amount using Regex Based Extractor

Hi Community,

I was trying to use regex based extractor to extract figures from the Net Amount Due from the invoice but it has varieties format as follow text file attached:

For sample number 3,4 and 5, it does not appear in the same line

The original data screenshot invoice will be as follow (sample 5 ):
image
Testing.txt (1022 Bytes)

Would like to ask for help for the above five scenario of the invoice net amount due data.May i know if anyone face this issue before?

The expected output will be as follow:
Sample 1 ) 730,448.38
Sample 2 ) 593,126.84
Sample 3 ) 5,197.50
Sample 4 ) 236,645.35
Sample 5 ) 72,288.19

Many thanks again for the help.

1 Like

HI @SH_94

Can you send the expected output from the above?

Regards
Sudharsan

1 Like

If possible send the text file with preserved format

Regards
Sudharsan

1 Like

@SH_94

Try with this expression
(?<=Net Amount Due )((\d+.\d+.\d+))|(?<=\n)(\d+.\d+.\d+)

Regards
Sudharsan

Hi @Sudharsan_Ka ,

I have reuploaded the format using text and included the expected result.

Many thanks again
Testing.txt (1022 Bytes)

Hi @Sudharsan_Ka ,

I try the regex ady and it only work for sample 3 and 5…While sample 1,2 and 4 does not work in this case.

Many thanks in advance

HI @SH_94
(?<=Net Amount Due)\s+(\d+.\d+.\d+)|(?<=\n[A-Z]{3}\n\n).*(?=\n)

Try this and you need to do one thing before returning to excel

  • You need to trim the values
  • You need to split by space and return the last value

Regards
Sudharsan

1 Like

Hi @Sudharsan_Ka , i try using this one and now it does not work for sample 3 and 5. I reattached the text file just in case u miss it.

Testing.txt (1022 Bytes)

1 Like

both the values have been matched

The 3 and 5 values need to use split method to get the appropriate value

Can you try this split(Value 3," ")(2)
image

Regards
Sudharsan

2 Likes

Hi @Sudharsan_Ka ,

Is there anyway that we can automate to split it in the Uipath if we encounter this scenario? As the number can be change from time to time.

Many thanks again

1 Like

Okay but you need only the last value of the line right?

Regards
Sudharsan

1 Like

If you need the last value all the time you can use split like this

Split(β€œ4,725.00 472.50 5,197.50 25”," β€œ)(Split(β€œ4,725.00 472.50 5,197.50 25”,” ").Count-1)

It will retrieve the last value in the whole string

Regards
Sudharsan

1 Like

Hi @Sudharsan_Ka ,

Many thanks for the help

1 Like

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