Regex: Find 3 different strings & sounds a message if any 1 is not found

Hi

I am new to Uipath. I have a .txt file and there are 3 strings I need to find
“Statistically significant at 1 percent level.”
“Statistically significant at 5 percent level.”
“Statistically significant at 10 percent level.”
If any 1 string is missing, I want a message stating so.

I think Regex can do it, but I am not sure. Any guidance will be appreciated.

Thanks

@Anonymous2 You can use Contains method to Check for that Specific String Exists or not, If you have to extract any value from the File then you can use regex

use Read Text activity and get output like outText
use assign activity like this
varArr = outText.Split(Enviornment.Newline.TocharArray)
use For each loop and pass varArray as input to For each loop
and use IF activity and pass condition like this
Item.ToString.Contains(“Statistically significant at 1 percent level.”)

Hi

Thank you.
May I know where I can read up more about the syntax for “Split”?

Where can I know more about all the different methods, outText, Split, etc?

Thank you

@Anonymous2

Split is a .net Function, so you can search in google for .Net split function, you will get different examples

You can refer below to understand the split() function

Hope this helps

Thanks

Hi
This can be done with Regex itself like
If the string is obtained and stored in a variable named str_input
Then use a assign activity like this
bool_exists = System.Text.RegularExpressions.Regex.IsMatch(str_input.ToString,”(Statistically significant at 1 percent level.|Statistically significant at 5 percent level.|Statistically significant at 10 percent level.)”)

Where bool_exists is a variable of type Boolean where if any of these string is there in the string we get from the text file is there it will give use True or as False

Now using this boolean value we can use in IF

Cheers @Anonymous2

Hi

Thank you for the reply. I want bool_exists= true only if ALL of the conditions are present.
How do I amend the Regex formula?

THanks!

hello @Anonymous2

Assign this code to a boolean datatype variable it’ll check and give you whether all the three are present or not check it and let me know about it

if( (System.Text.RegularExpressions.Regex.IsMatch(Text_Output,"Statistically significant at 1 percent level").ToString+"|"+System.Text.RegularExpressions.Regex.IsMatch(Text_Output,"Statistically significant at 5 percent level").ToString+"|"+System.Text.RegularExpressions.Regex.IsMatch(Text_Output,"Statistically significant at 10 percent level").ToString).Split("|"c).Contains("False"),False,True)

the above code consist of three IsMatch method checking all the three values and combining it with a if we directly get a boolean value
Also here text_Output is my string variable

Hi

Thanks so much for the reply! I have found another way to solve my problem.