Thanks Dmitry

I want to find any string in another string that could be a plain string, a $LIST, or a series of nested $LIST to any depth - basically an unkown structure. The string I'm searching in can be any size and the pieces can be any size. And I wan't to do a case insensitive search through a large amount of data and I want instant results. And I want to know the character positions of what was found. And I want the results in a human readable format. And just to make it hard, it has to run on everything from Caché version 5 upwards which means $LISTNEXT, $LISTVALID are not always available.

That would be fine if I was looking for the full element value as my search string. I'm looking for any occurance, full or part, in a lot of data.

 From the documentation:
  $LISTFIND searches the specified list for the first instance of the requested value. A match must be exact and consist of the full element value. Letter comparisons are case-sensitive. Numbers are compared in canonical form. If an exact match is found, $LISTFIND returns the position of the matching element. If value is not found, $LISTFIND returns a 0.

 // Suppose the string I'm  looking in is in
 S X=$LB("Stuart Strickland","Yaron Munz") // X could be anything
 // and I'm looking for "MUNZ"
 I $zcvt(X,"u")["MUNZ" Q 1  // I think this is quick but could cause a problem by converting lower case $LIST spacers to upper
 S sc=0 F i=1:1:$LL(X) S Y=$LG(X,i) I $zcvt(Y,"u")["MUNZ" s sc=1  // I think this is slow
 S sc=$LISTFIND(X,"MUNZ")         // I know this will not work
 S sc=$LISTFIND($zcvt(X),"MUNZ")  // I know this will not work and might even cause an error
 Q sc