Using regex to match and extract multiple matches

Hi guys,

I’ve managed to use regex to match a particular field of information from a pdf file. However, I need to extract multiple permutations of the same structured information.

The following information, “dist:01,185SQN,02/04,04/04” was successfully identified by my regex code “System.Text.RegularExpressions.Regex.Match(pdftxt, “dist:(\d+,\w+,\w+/\w,\w+/\w)”).Groups(1).Value.ToString”

However, I would also like to extract the following information “dist:01,Kat,Nil,01/04” which also corresponds to my regex code. Right now, my code only extracts the first piece of information and ignores the second. Can someone help me extract both?

Here is my xaml file for reference.
Extract DT.xaml (5.8 KB)
Distribution List.pdf (59.7 KB)

Thanks in advance!

If you use the matches activity on UiPath you can specify how many instances of the identified text you should return to the final list.

1 Like

Hi @Spacecats7,

Use Matches activity then configure reg expression.
https://activities.uipath.com/docs/matches
https://activities.uipath.com/docs/regex-builder-wizard

@Spacecats7 I have updated your xaml now its working please check it and let me know.

Extract DT.xaml (9.1 KB)

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