class_docstr: This is a plain string search helper for the spawn.expect_any() method.
  This helper class is for speed. For more powerful regex patterns
  see the helper class, searcher_re.
  
  Attributes:
  
      eof_index     - index of EOF, or -1
      timeout_index - index of TIMEOUT, or -1
  
  After a successful match by the search() method the following attributes
  are available:
  
      start - index into the buffer, first byte of match
      end   - index into the buffer, first byte after match
      match - the matching string itself
class_docstr_tok: ["This","is","a","plain","string","search","helper","for","the","spawn.expect_any","(",")","method",".","This","helper","class","is","for","speed",".","For","more","powerful","regex","patterns","see","the","helper","class",",","searcher_re",".","Attributes",":","eof_index","-","index","of","EOF",",","or","-1","timeout_index","-","index","of","TIMEOUT",",","or","-1","After","a","successful","match","by","the","search","(",")","method","the","following","attributes","are","available",":","start","-","index","into","the","buffer",",","first","byte","of","match","end","-","index","into","the","buffer",",","first","byte","after","match","match","-","the","matching","string","itself"]
docstr: This searches 'buffer' for the first occurrence of one of the search
  strings.  'freshlen' must indicate the number of bytes at the end of
  'buffer' which have not been searched before. It helps to avoid
  searching the same, possibly big, buffer over and over again.
  
  See class spawn for the 'searchwindowsize' argument.
  
  If there is a match this returns the index of that string, and sets
  'start', 'end' and 'match'. Otherwise, this returns -1. 
docstr_tok: ["This","searches","'buffer","'","for","the","first","occurrence","of","one","of","the","search","strings",".","'freshlen","'","must","indicate","the","number","of","bytes","at","the","end","of","'buffer","'","which","have","not","been","searched","before",".","It","helps","to","avoid","searching","the","same",",","possibly","big",",","buffer","over","and","over","again",".","See","class","spawn","for","the","'searchwindowsize","'","argument",".","If","there","is","a","match","this","returns","the","index","of","that","string",",","and","sets","'start","'",",","'end","'","and","'match","'",".","Otherwise",",","this","returns","-1","."]
code: def search(self, buffer, freshlen, searchwindowsize=None):
      """This searches 'buffer' for the first occurrence of one of the search
      strings.  'freshlen' must indicate the number of bytes at the end of
      'buffer' which have not been searched before. It helps to avoid
      searching the same, possibly big, buffer over and over again.
  
      See class spawn for the 'searchwindowsize' argument.
  
      If there is a match this returns the index of that string, and sets
      'start', 'end' and 'match'. Otherwise, this returns -1."""
  
      first_match = None
  
      # 'freshlen' helps a lot here. Further optimizations could
      # possibly include:
      #
      # using something like the Boyer-Moore Fast String Searching
      # Algorithm; pre-compiling the search through a list of
      # strings into something that can scan the input once to
      # search for all N strings; realize that if we search for
      # ['bar', 'baz'] and the input is '...foo' we need not bother
      # rescanning until we've read three more bytes.
      #
      # Sadly, I don't know enough about this interesting topic. /grahn
  
      for index, s in self._strings:
          if searchwindowsize is None:
              # the match, if any, can only be in the fresh data,
              # or at the very end of the old data
              offset = -(freshlen + len(s))
          else:
              # better obey searchwindowsize
              offset = -searchwindowsize
          n = buffer.find(s, offset)
          if n >= 0 and (first_match is None or n < first_match):
              first_match = n
              best_index, best_match = index, s
      if first_match is None:
          return -1
      self.match = best_match
      self.start = first_match
      self.end = self.start + len(self.match)
      return best_index
  
imports: import time
  from .exceptions import EOF, TIMEOUT
label_desc: Use image node_id 3 for calling the searcher_string obj's underlying member method code with example usage: obj.search(buffer, freshlen, searchwindowsize) and returns: best_index, unknown