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.
@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
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
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