How to check IEnumerable(Match) variable through IF statement

Is it possible to check that IEnumerable(Match) variable containes the matching result or not.

IF yes then how can we do that with IF statement?

Your question can be interpreted in many directions

When IEnumarable(Of Match) has a match item, we could assume that there was a match

a YourIEnumerableVar.Any() would reflect it

Finding Matching pattern will always give a match?

what if it didt find the match? how would I know that It didt not find a match??

I want to be sure that if that find a match then give me value of groups … and If not then give an error massage…

that I want to build.

Hi @Ellen

You can use the below expression to check the matching result contain in the String Variable

- Assign -> BoolFlag = System.Text.RegularExpressions.Regex.IsMatch(yourstringinput.ToString,“(Give regex here)”)

The BoolFlag variable is the Boolean datatype which give the output true or false.

Hope it helps!!

give a try at the given statement

You can quickly inspect and prototype within the immediate panel
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

Unfortunately we cannot map on what is meant with

Finding Matching

with the Any Check you can test before accessing

Hi @Ellen ,

You can use If yourVar.Contains(“something”).

We assume that the matches Activtiy is involved (You mentioned IEnumerable(Of Match) And not MatchCollection (output from Regex.Matches)

A pattern could look like this:

1 Like

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