0 votes
1 view
in RPA by (12.8k points)
edited by

I'm using a regex code to check if the value of an output code, if it's, contains a number 0 (zero)

Btw, I'm using UiPath.

Here's what I did, but when it shows number 1, it sends me true, which it shouldn't!

Code :

System.Text.RegularExpressions.Regex.IsMatch("output_matches(0)","[0]")

1 Answer

0 votes
by (29.8k points)
edited by

what you are doing is passing a string with value "output_matches(0)" and not the actual content of the first element of the array. Since you have a 0 in that string it will match the regex.

If you simply need to check if output_matches(0) is the value "0" you can use the =-operator: output_matches(0) = "0".


If you need to check if output_matches(0) contains a zero you can use output_matches(0).contains("0")

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jan 24 in RPA by Abhishek_31 (12.8k points)
0 votes
1 answer
asked Jul 4, 2019 in RPA by Abhishek_31 (12.8k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...