How to check Matchcollection type variables are equal or not

i have variables with variable type of MatchCollection and i want to check whether both variables are equal are not
.Equals method will work? or converting it to string??

Hi @Pogboom

The MatchCollection class in .NET represents a collection of Match objects, which are the results of a search for a regular expression.

To compare two MatchCollection variables to see if they are equal, you can use the Equals method. This method compares the elements in the collections to determine if they are equal, rather than just comparing the references to the objects.

Here is an example of how you can use the Equals method to compare two MatchCollection variables


where is the example?

@Kaviyarasu_N please find this screenshot
why it is coming as false?

it is checking the Object identities.

Depending on your Regex and requirements one of many options :

mc1.Cast(Of Match).SelectMany(Function (x) x.Value).SequenceEqual(mc2.Cast(Of Match).SelectMany(Function (x) x.Value))

grafik (9.5 KB)
Please see this code i want to check if mc1 and mc2 have same data then only it should proceed forward with calculation
Can you help me with the additional steps ??

the check statement was shown above with the immediate panel snippets

For your modelling we would recommend to checkout:

So within an If Activity you can check and decide the furthe processings

ok my only concern is that the check snippet you shared same will be applicable for the code which i shared with you?

here we debug and use the immediate panel for rnds and prototypings. the benefit is you can do it quickly with the real data. In general we would see the question as answered and ideally the topic could be closed by:
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum

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