Uipath regex to extract line items from a large string

hi all,

I have a text file where I have one large string. I am uploading the txt file.
REGEX (1).txt (2.3 KB)

from this txt file I have to extract the line items and line items will be below:

1)\TRF EMENEUNO SL
B979954500 \TRFCHK2023033011382378715 \PAGO FRA 16/02-15/03 \ \TRF WARNER BROS ENTERTAINMENT

2)\TRF JCS SPAIN TRIPLE NET BETA S.L, B87903514 \NOT PROVIDED \anticipo AIR \ \TRF WARNER BROS ENTERTAINMENT

3)\TRF MORALES BARATA HAROLD, 05941736P \NOT PROVIDED \ABONO FACTURAS
01005003 01005013 01005025 HAROLD MORALES
\TRF WARNER BROS ENTERTAINMENT

and so on. I have tried so many regex but I could not able to extract all the line item accurately.

can anyone help me to find out the correct regex so that I can get all the line items accurately

Read Text File
Generate Data Table (Format Custom, set delimiter as \\ and NewLine as [newline])

Hi

A pattern can be created but it may only work for the current requested items.

If you tell us more about the text and the patterns you can get a more robust regex pattern. So what is consistent?

Cheers

Steve

Pattern : the line item always start with “\TRF” and it will be ends with “\ \TRF WARNER BROS ENTERTAINMENT”

So if check the text file care fully then you will get lots of line items which will be below

TRF JCS SPAIN TRIPLE NET BETA S.L, B87903514 \NOT PROVIDED \anticipo AIR \ \TRF WARNER BROS ENTERTAINMENT

In my post i have given only 3 line items example. But if you follow the pattern which I have just mentioned you will get many more line items.

Hi again

Do you happen to know the B1234578 reference before hand?

Basic pattern created here:

You could use the above pattern then use a for each to identify each result accordingly.

Hi @roysupriya21

Try this regex:

\\TRF[\s\S]*?BROS\sENTERTAINMENT

Hope it helps!!

Hi @roysupriya21

The following is the regex expression with expected output.

\\TRF[\s\S]*?ENTERTAINMENT

Hope it helps!!

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