Regex needed in order to get data

Hi, I need a regex that makes 5 groups and captures values in them, example:
(empty line but I can remove it if the regex is made to be working without it)
Apa plata 5 15.24 0.76 16.00
Restaurant Automat (5%) 5 43.81 2.19 46.00
Bere 19 8.40 1.60 10.00
Restaurant Automat (19%) 19 8.40 1.60 10.00
Lets take the first line as example, for it I need “Apa plata” in the 1st group, “5” in the 2nd group, “15.24” in the 3rd group, “0.76” in the 4th group, “16.00” in the 5th group.
Lets take the 2nd line as example, I need “Restaurant Automat (5%)” in the 1st group, “5” in the 2nd group, “43.81” in the 3rd group, “2.19” in the 4th group, “46.00” in the 5th group.
And so on for each line. The string may have in between 1 and 999 lines, this is just an example.
I want to use the regex in a “Matches” activity and iterate through the matches using for each.
I can provide further details upon request.

Hi @s0biesky ,

Is this what you were looking for?

image

(^[A-z\s]+\(\d+\%\)|^[A-z\s]+(?=\s))\s?(\d+)\s(\d+\.\d+)\s(\d+\.\d+)\s(\d+\.\d+)

Kind Regards,
Ashwin A.K

1 Like

Hi,

Can you try the following?

Pattern is

"(.*)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)$"

with Multiline option.

Sample20220322-4.zip (2.6 KB)

Regards,

Hi @s0biesky ,
Please find the below Regex pattern to get the details.
(\d*\.?\d+)
image

Refer below link

Regards,
Arivu

Yes, thank you!

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