Regex collection Output Issue


I am targeting invoice details with Regex. I have build a loop where matches go to their own Lists(of objects). When i write line items i get System.Linq.Enumerable+d__97`1[System.Text.RegularExpressions.Match]

How do i get values out of the match lists?


argument type should be object please do check.

Argument is object

and you are using item var both for each change any of them!

item in strSplitPDF
item in arrMatchOrder change of them

@Mikko_S What’s the Type of strSplitPDF?

string is the type. It is the result of string splitted PDF fulltext.

1 Like

@Mikko_S Oops My Bad, I asked the wrong question, I understood what you’re doing now :sweat_smile:

@Mikko_S Can you send the xaml file with the input? It looks to me Like you’re Adding the Output of Matches Activity to a Collection, which is arrMatchOrder, Am I right ?

Did you tried what i was saying?

Exactly right.
Pradeep_Shiv > I would like to start loop from splitted string because i need to target multiple regexes to same file.

1 Like

can i see your workflow?

@Mikko_S Keep the Type of item in Second For Each as System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Match>

Then use another For Each Inside it where pass the input as item of first for and type argument keep it as Match
Then use a write Line for that variable

Something like this :

1 Like

The matches activity results in IEnumerable. i.e., the result will have more than one occurrence.
Hence you need to loop through each occurrence and then use add to collection activity inside the loop.
P.S: The object type in for each activity should be match and while writing it into collection, convert it to string.

Please let me know if this is helpful.

1 Like

Ok so i had to add one more loop to get values out.
Thank you guys for quick help!

1 Like

Hi @supermanPunch
Out of curiosity, Is it possible to explain the use of two for each’s here?

@Madhavi listOf variable is of the Type List<IEnumerable(Match)>
Hence this is the flow,
For each item in listOf, now Item is of type IEnumerable(Match)
For Each item1 in item, now item1 is of type Match

I hope you got what i am doing here :sweat_smile:

1 Like

You can achieve this using one single loop instead of two right.

@Madhavi Oh, I found out the way using Two loops, if you have a Better way , Please Share the way How to use, People get benefitted if it is efficient :sweat_smile:,

In my case i’ve multiple PDF:s in a same folder so my first loop is fetching those files. For Matches i guess one nested loop is enough. :slight_smile: