How to get index of a regular expression match collection element

Using the Find Matching Patterns Activity, the result collection is of type System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Match> from which i want to find the index of a particular element in the collection.

E.g :- The Result is [250,500,1,2,5]. How to get index of 500

@Quenton_Wayne_Rebello
Try this one

Assign activity:
- Left-hand side: index
- Right-hand side: resultCollection.ToList().IndexOf(500)

I appreciate your suggestion, and I gave the method a try. Unfortunately, I encountered an error (Value of type String cannot be converted to System.Text.RegularExpressions.Match) while attempting to use it. I’m grateful for your assistance, and I’m open to any other suggestions or alternative approaches you may have. Thank you for your understanding!

@Quenton_Wayne_Rebello let me check why its encountered error.

@Quenton_Wayne_Rebello
Index variable should be Int32 type

@Quenton_Wayne_Rebello
In my case 56 present in 3rd index.


Please mark it as a solution if your problem solved.

Thank you for the solution @raja.arslankhan !!!

1 Like

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