Getting problem with regex matches

Thanks @Dave
It’s working great.
My second type of pattern can you?

“Grand Total $3,100.12”
“INSURANCE PAY 4,092.00”
“Net Total: 5,974.84”
“Net Total 6,414.88”

That’s good to hear - can you provide an explanation of what you’re trying to do (it looks like pull out the total amount), then a sample text, then what you want to be matched from the sample text? Just like you did for the address portion

As i told you i have one txt file there may be string

D & E AUTO BODY REPAIR
402 WAKEMAN AVENUE / P.O. BOX 450
GRAFTON, ND 58237
OFFICE: (701) 352-3180 FAX: (701) 352-4998
FEDERAL TAX ID# 27-0759714
*** PRELIMINARY ESTIMATE ***
02/11/2019 10:46 AM
Owner
Owner: PERLA MENDOZA
Address: Work/Day: (701)360-1002
Inspection
Grand Total $3,100.12
Inspection Date: 02/11/2019 10:46 AM Inspection Type:
Appraiser Name: JASON A NELSON Appraiser License # :
Repairer

either
“Grand Total $3,100.12”
or
“INSURANCE PAY 4,092.00”
or
“Net Total: 5,974.84”
or
“Net Total 6,414.88”

[0-9,]+\.\d{2}

Assumptions:

  1. This pulls out any dollar amount. If there is more than one on the page they will all be matches
  2. All amounts will have a decimal and 2 digits after it.

EDIT: If you want to make it so it looks for the words Total or Pay, then just add that a tthe beginning as a positive lookahead

@Dave
not only number
With text
“Grand Total $3,100.12”
whole this capture in regex

One more thing how can i search before first line capturing address regex

Don’t get the words Total/Grand Total/Pay/etc in your regex. Use the expression to pull out the numbers, then append the number to the word “Total” or whatever you want outside of the regex

i have many numbers
in txt-1 file

Total Labor: 128.90
II. Total Replacement Parts: 1,230.93
III. Total Additional Costs: 0.00
Gross Total: 1,359.83
IV. Total Adjustments: 0.00
Net Total: 5,974.84

in txt-2 file

Total Labor: 128.90
II. Total Replacement Parts: 1,230.93
III. Total Additional Costs: 0.00
Gross Total: 1,359.83
IV. Total Adjustments: 0.00
INSURANCE PAY 4,092.00

I have to find out

either
“Grand Total $3,100.12”
or
“INSURANCE PAY 4,092.00”
or
“Net Total: 5,974.84”
or
“Net Total 6,414.88”

The first example you provided didn’t show those possibilities. Here is an updated one that assumes that you want only numbers after Net Total, Grand total, or insurance pay. Make sure for regex options that you IGNORE case (so it does not care if it is upper or lower case)

(?<=((net|grand) total|insurance pay).*)[0-9,]+\.\d{2}

I got the 6 matches from the following text:

D & E AUTO BODY REPAIR
402 WAKEMAN AVENUE / P.O. BOX 450
GRAFTON, ND 58237
OFFICE: (701) 352-3180 FAX: (701) 352-4998
FEDERAL TAX ID# 27-0759714
*** PRELIMINARY ESTIMATE ***“Grand Total $3,100.12”
or
“INSURANCE PAY 4,092.00”
or
“Net Total: 5,974.84”
or
“Net Total 6,414.88”
02/11/2019 10:46 AM
Owner
Owner: PERLA MENDOZA
Address: Work/Day: (701)360-1002
Inspection
Grand Total $3,100.12
Inspection Date: 02/11/2019 10:46 AM Inspection Type:
Appraiser Name: JASON A NELSON Appraiser License # :
Repairer
Total Labor: 128.90
II. Total Replacement Parts: 1,230.93
III. Total Additional Costs: 0.00
Gross Total: 1,359.83
IV. Total Adjustments: 0.00
Net Total: 1,359.83

I’d highly recommend just grabbing out the numbers like this regex is doing, then if you need to add text, do it after the fact. If you truly need to grab everytihng, then just get rid of the (?<=) portion so it’ll grab it all:
((net|grand) total|insurance pay).*[0-9,]+\.\d{2}

1 Like

thanks @Dave
It’s working
One more thing is that how can i find before first line of address regex

I’m not sure what you mean? Can you provide more details or context for your question?

you gave me regex find address this
“\d+.+(, [A-Z]{2} [0-9]{5})|\d+.+\r\n.*(, [A-Z]{2} [0-9]{5})”

D & E AUTO BODY REPAIR
402 WAKEMAN AVENUE / P.O. BOX 450
GRAFTON, ND 58237
OFFICE: (701) 352-3180 FAX: (701) 352-4998
FEDERAL TAX ID# 27-0759714
*** PRELIMINARY ESTIMATE ***
02/11/2019 10:46 AM
Owner
Owner: PERLA MENDOZA
Address: Work/Day: (701)360-1002
Inspection
Grand Total $3,100.12
Inspection Date: 02/11/2019 10:46 AM Inspection Type:
Appraiser Name: JASON A NELSON Appraiser License # :
Repairer

then i am asking before address i haven to get first any line

D & E AUTO BODY REPAIR
402 WAKEMAN AVENUE / P.O. BOX 450
GRAFTON, ND 58237

Easiest way I can think of off the top of my head would be:

Perform 1st regex to get the address and store match as a string I’ll name StringAddress

Now do a regex again on the full text and do the following:

.+(?=\r\nStringAddress)

In Uipath if you were using the matches activity you’d put it in the regex input property like this:

".+(?=\r\n" + StringAddress + ")"

Now I am going meet you tomorrow and thanks a lot