Regex doesn't return anything even if Test Text finds a match

Dear colleagues,

I am trying to extract this part from a dummy invoice.
As you can see the regex finds a match (?<=Service Cost Line Total\s{2})(.?)(?=\s€)|(?<=1\s)(.?)(?=\s\d)4

… but when I run the workflow, I get the error Object reference not set to an instance of an object.

I attach the full text: sample_2.txt (463 Bytes)
Please let me know if you need also the workflow.

hi @Cardon_Cezar,

Just goto import and import System.Text.RegularExpressions

add Assign and type following code
to get the whole text


to get monetary value only


or use following workflow i created using your sample txt file (16.1 KB)

If it’s the answer you find out please mark as answer

Hi @SamanGuruge

Thank you for your reply. RPA Community is the invoice service name. However, the purpose of my demo is to process multiple invoices, each of them having a different invoice service name.

As a pattern, the invoice service name is between “Service Cost Line Total” and the euro sign, €, followed by the amount in euro.

Hi @Cardon_Cezar,

that can be done by using Datatable or excel file you need to include all the identifying regex pattern into that or you can send each and every invoices in different path by identifying the name of file if it’s unique one.

additionally to above if you give me different type of samples I can create a workflow for you

@Cardon_Cezar Can you Try this Regex Expression :
(?<=Service Cost Line Total\n\n).+?(?=€)

If it Still Doesn’t work, change the RegEx from Literal to Advanced in the Regex Builder and Check if it is able to extract the required String.

1 Like

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