How to fix error


Write Line: Object reference not set to an instance of an object.
I cant figure out how to fix this

Hi,

Perhaps, result of regex is empty. Please review your regex pattern and/or input string.
If there is possbility result is no match, please check it using the following exprssion in If activity in advance.

ieMatch.Any()

Regards,


hmm my regex patter in correct what is wrong here?

HI,

Can you try as the following?

Regards,

12/06/2022 08:20:28 => [Debug] Execution started for file: Sequence4
12/06/2022 08:20:28 => [Info] UI PATH PROJJECT execution started
12/06/2022 08:20:31 => [Debug] INVOICE

Tea Leave Supplier Pte Ltd

Blk 120 Bedok Avenue

Singapore 500120

Tampines Bubble Tea Pte Ltd Date: 10/1/2022

Blk 772 Tampines St 71 Invoice No.: TLS162

Singapore 520772 Your PO No.: 316

S/No. Description Qty Unit Price Total ($)
($)
1 Apple Flower Tea Leave (200g) 2 18 36
2 Phnom Penh Rose Tea Leave 2 25 50
(100g)

Amount Due 86

Please pay within 30 days

Thank you.

< This is a computer generated invoice which does not require any signature>
12/06/2022 08:20:31 => [Info] UI PATH PROJJECT execution ended in: 00:00:02

This is the string I’m extracting from and this is my regex code
(?<=INVOICE\n\n)\S.* but it still shows a no match

Hi,

Can you share your expected output?

Regards,

Tea Leave Supplier Pte Ltd

Hi,

How about the following pattern?

(?<=INVOICE\s+).*

Regards,

[quote=“ADELARD_KAZUMA_HO, post:5, topic:496462”]

(?<=Invoice¥s+).* This is the regex code right to double check. still shows no matches for me.


output is empty somehow

Hi,

It seems to match empty string, too. Can you try to use the following pattern?

"(?<=INVOICE\r?\n\r?\n).*"

Regards,

[quote=“ADELARD_KAZUMA_HO, post:5, topic:496462”]
Thanks it worked. I would also like to extract out the Invoice No and Amount due and then place it in an excel sheet. Any idea how to do that?

Hi,

We can extract these value using the following pattern.

"(?<=Invoice No.: ).*"

"(?<=Amount Due ).*"

Then, we can write them to your sheet using WriteCell activity (or Write Range activity with DataTable)

Regards,

I think i have the correct pattern but how do i continue from there and then place the three variables in the excel sheet? Do i repeat the match function 2 more times? thanks.

Hi,

It’s one of solutions. There are many ways to achieve it.
The following is a sample using Regex.Match method (instead of Matches activity) and datatable. Hope this helps you.

Sample20221206-3.zip (3.4 KB)

Regards,


I changed the assign activity of my string to a read pdf file then this error popped up. How do i fix it? thanks.

Hi,

I guess yourString variable is null. Did you assign it? ( Or change it to your variable which is from pdf)

Regards,

sorry yoichi-san i dont understand at all what to do

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