How to iterate over IEnumerable<Match>?

I have a variable named “SplittedText” of type IEnumerable<Match and I want to iterate over those MatchedTexts, so i used a for each loop of Argument type System.RegularExpressions.Match and then used log message to print the matched results but not able to get any…

@Sami_Rajput
if it possible can you share the sample text and matched text you need from it

Cheers!!

Hi @Sami_Rajput

You need to use For Each loop to iterate through the variable of DataType IEnumerable(Match) variable.

Regards,

Hi @Sami_Rajput

Check whether you are passing the correct input and output variables are shown as below

Hope it helps!!

@Sami_Rajput

First make sure that SplittedText has at least one match case with SplittedText.Count. If the variable has output data then use for each activity to loop the output.
Refer to Sequence.xaml .
Sequence.xaml (7.6 KB)

1 Like

Hi
Drag and drop a “For Each” activity onto your workflow.
Set the “TypeArgument” property of the “For Each” activity to System.Text.RegularExpressions.Match since you are iterating over matches.

In the “Assign” activity or wherever you are populating the SplittedText variable, make sure it’s of type IEnumerable. This variable should be the result of a regular expression match operation.

Inside the “For Each” loop, use a “Log Message” activity to print the matched results.
Access the current match using the item variable provided by the “For Each” loop.

For Each item In SplittedText
Log Message → item.Value