Matches Activity is outputting whole match instead of the capturing groups

My automation uses a regex pattern to extract a part of larger piece of text. Such as:

U123456 West Dunbartonshire Council Ladyton Nursery, Ladyton, Bonhill, Alexandria, West Dunbartonshire, United Kingdom G83 9DZ

U789012 Glasgow City Council St Mungo’s Primary, 45 Parson Street, Glasgow, United Kingdom G4 0PX

U345678 The City Of Edinburgh Council Boroughmuir High School, 111 Viewforth, Edinburgh, United Kingdom EH10 4LR

Now, using the UiPath.Core.Activities.Matches Activity, i ran the following regex to capture the first line of the address for my comparison.

Council\s(.*?),

However when running, the output IEnumerable Produced the output include the word Council, the whitespace, adn the comma. None of which are in the capturing group.

I have tried naming the capture group(and making the other elements in the pattern non-capturing groups) as well as using the Regex Option to ExplicitCapture to try to narrow down what is being requested, but to no avail.
The Matches Activity is always outputting the full match as oppose to what I specifically want to capture.

Could anyone assist and let me know if it is at all possible to output just the required string.

For Example, in each of the example I have provided, I wish for the Outputs:

  • Ladyton Nursery
  • St Mungo’s Primary
  • Boroughmuir High School

@LewisHenderson …it should be after the council and before the comma…try adding (?=,) at the end it will pick the data you want …

Update : Like this…(Just for example I have all three texts in one shot)

1 Like

@LewisHenderson - Did you get a chance to try ? If yes and it solved your query, please mark my post as solution that will close this thread.

1 Like

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