Using string.find

I’m trying write some code that looks at two data sets and matches them (if match), at the moment I am using **string.find** and this kinda work but its very rigid. For example: it works on **check1** but not on check2/3, as theres a space in the feed or some other word. i like to return a match on all 3 of them but how can i do that? (match by more than 4 characters, maybe?)

check1 = 'jan' check2 = 'janAnd' check3 = 'jan kevin' input = 'jan is friends with kevin' if string.find(input.. "" , check1 )  then print("match on jan") end if string.find( input.. "" , check2 )  then print("match on jan and") end if string.find( input.. "" , check3 )  then print("match on jan kevin") end

PS: i have tried gfind, gmatch, match, but no luck with them 

How would check2 work?

If you’re trying to make sure each of the terms is found in each, a reasonable approach is to do a split (see e.g. here and here) of both your input and check, then search for each of the elements (with string.find , for instance) in one of those among all the elements of the other, declaring success if all searches pass.

Actually, if one of your inputs is coming from user input, thismight be worth a look, too.

thanks StarCrunch ill have a look in the morning 

How would check2 work?

If you’re trying to make sure each of the terms is found in each, a reasonable approach is to do a split (see e.g. here and here) of both your input and check, then search for each of the elements (with string.find , for instance) in one of those among all the elements of the other, declaring success if all searches pass.

Actually, if one of your inputs is coming from user input, thismight be worth a look, too.

thanks StarCrunch ill have a look in the morning