I see multiple possible reasons why this expression does not resolve as you might be wishing...
None of the reasons rest with the way you are grouping things together.
What exactly is in the variable $text ?
By its name, I have to expect it holds a text string, and not a list.
Sometimes you treat it as text, & others as a list with sublists?
1) In these parts of the expression, you treat $text as a nested list, sort of, and badly (these will probably never resolve to true)...
Code: Select all
([lsearch -exact -ascii -nocase [lindex $text 0 end] [lindex $who1 0 end]] != -1)
2) Right after that, you treat $text as a text string, properly splitting it into a list...
3) And you finish off treating $text as a text string again...
Code: Select all
([string index $text end] == "$whof")
4) Then at the very end of your expression you just throw in an extra bit of code that has no home at all.
Even if the rest of that expression was correct, just throwing in extra operators here and there can't possibly help:)
In order for anyone to try to help with this mess, we would need much more information on what is included in the vars $text and $who1, 2 & 3.