How do we check in ui path if the matches result contains empty string or spaces without looping?

How do we check in ui path if the matches result containt empty or spaces without looping ?
Like as you can see in the images I wante to check if the result from the maches contains any empty string or spaces without doing a loop , is that possible ? Thank you.



Make a IF condition and check as below

Mark as solution if this helps


1 Like

@RajivKumar12 Maybe you can use a Linq to get the output you need and provided that you do not have any groups created in the regular expression, I think the below expression should give you the result as either True or False.

matches.Any(Function(x)String.IsNullOrEmpty(x.Value.Trim) or String.IsNullOrWhiteSpace(x.Value.Trim))

where matches is the output of Matches activity. If any one value is Empty or has just spaces, It will result in True

1 Like

does not seem to work keeps returning true

result consists of none empty and empty strings , I just need to check for one empty .

@RajivKumar12 What exactly is the output that you need to get ?

If empty string or space is found in a matches result just return true else false

@RajivKumar12 So you want it to return True when all the result values are Empty ?

if all are empty return true , if one or more empty return true if no empty return false.

cause the result from matches does not contain single data , if you loop through it , it containts many data.

@RajivKumar12 Yes, The expression that I have provided should return True when one or more values are empty in it. If all the values are not empty it will return false.

Can you cross check with a For Loop ? Just for verification


Check as below

result.Count=0 or string.IsNullOrWhiteSpace(result.ToString)

Hope this helps


this solution requires looping

how do we ge the total count of each result in a matches without doing a loop ?

@RajivKumar12 I think we would need to know more about what you actually want to do :sweat_smile: , The Result count can be got just by using the Count Method in the below way :


thanks man

1 Like

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