Multiple Keyword checking

hey i want to check these many words are in my file or not how can i check that ?

thanks
cheers :slight_smile:

have you tried using And or OR

NO @Pradeep_Shiv
where should i use AND or OR and How ?

1 Like

Hi @Mayur_Pawar,

Try this
OUTTEXT.Contains("Master") OR OUTTEXT.Contains("Search") OR OUTTEXT.Contains("Iterate")

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.IsMatch(OUTTEXT,"Master|Search|Iterate")

Regards,

with a simple approach
save all those terms in a array variable named arr_Values
then in IF condition mention the condition like this
arr_Values.Contains(OUTTEXT.ToString)

or

arrayvariable.AsEnumerable().Where(Function(a) OUTTEXT.ToString.Contains(a.ToString)).Count>0

Cheers @Mayur_Pawar

i like this is simple approach even i tried but its not working.
any other changes in code ?

yah like this

arrayvariable.AsEnumerable().Where(Function(a) OUTTEXT.ToString.Contains(a.ToString)).Count>0

Cheers @Mayur_Pawar

OUTTEXT.ToString.Contains("Master”)
or OUTTEXT.ToString.Contains("Search”)

i would have done like this

its work can you explain in short this query .
@Palaniyappan

1 Like

yah sure
first we have stored all the values to be compared in a array variable
then that in this expression without using loop we are trying to iterate through each value in the array and check for the contains method i.e., whether the OUTTEXT string has any value that we have in array variable
so asenumerable will get us the array elements as individual elements and check for the value in it
arrayvariable.AsEnumerable().Where(Function(a) OUTTEXT.ToString.Contains(a.ToString))

and atlast we have used count to check whether the match or contains is more than 0 and if that is true then the string OUTTEXT has a string within that array variable
so used the condition
arrayvariable.AsEnumerable().Where(Function(a) OUTTEXT.ToString.Contains(a.ToString)).Count>0

Cheers @Mayur_Pawar

1 Like

Kindly let know for any queries or clarification
@Mayur_Pawar

1 Like

hello @Mayur_Pawar,

I have added all the keyword in Collection
and used Code- ColOfKeyword.ALL(Function(s) Text1.toString.Contains(s))

This returns true if all the keywords are present.

Hope it helps!

Temp.xaml (12.0 KB)

Hi,

If you have keywords as string array (say arrKeywords), the following is more simple expression using LINQ.

arrKeywords.Any(Function(x) OUTTEXT.Contains(x))

Regards,

1 Like