"matchIndex" is a user defined variable that contains the return value from the "indexOf" for the string variable "text". The return value is the zero position of the first matched item or -1 if search went to the end of the string without a match.
-1 does not mean false. It means the number -1.
The following script provides the numeric values for the logical values of 'true' and 'false'
console.println("The logical value " + String(true) + " has a numerical value of " + Number(true));
console.println("The logical value " + String(false) + " has a numerical value of " + Number(false));
The results for the script:
The logical value true has a numerical value of 1
The logical value false has a numerical value of 0
You can also use matchIndex >= 0