Regex - Matching first Capturing Group

I have to extract information from the HTML in a web page.

More specifically i have this repeted format:

<a data-tree-item=“inv” data-tree-key=“InvID” data-tree-id=“110417-3L07-1316” href="#">110417</a></td>

In which i want to get the value (110417) if data-tree-item="inv"

Using the following Regex

(?<=<a data-tree-item="inv")(?:.*>)(.*)(?=<\/a)

I get always and only the correct lines with the following results:

Full Match= data-tree-key=“InvID” data-tree-id=“110417-3L07-1316” href="#">110417
Group 1= 110417

What i want to get in the automation is the list of “Group 1” but what i find in the array is “Full Match”

In PHP regex i know how to solve the issue (there is the \K reset match) but i don’t think it is possible to use that in UIPath

So what i would like to ask is:
There is a way to get in a collection the Group 1 Array?
There is a way to change the Regex i wrote to have the correct Full Match?

Thank you

Test with this regular expression:

(?<=<a data-tree-item="inv".*>).*(?=<\/a)

Thank you, it worked

1 Like

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