>do while not eof() >cfile = rtrim(teach) >IF 'KEYWORD'$(cFile) = .T. >? cfile >endif >skip >loop >enddo >>
lcLookFor = "myname" lnPrecedingChars = 10 lnFollowingChars = 10 * Within a single row: lnStartPosition = AT( lcLookFor, MyTable.MyField ) IF lnStartPosition > 0 * i.e. search expression is found * Be sure to handle cases where: * 1. The field length is less than LEN( lcLookFor ) + lnPrecedingChars + lnFollowingChars, AND/OR * 2. lcLookFor is near the start or end of the field * This code just handles the case where the field is plenty large enough, and * lcLookFor is comfortably in the middle of the field: lcResult = SUBSTR( MyTable.MyField, lnStartPosition - lnPrecedingChars, lnPrecedingChars + LEN( lcLookFor ) + lnFollowingChars ) ELSE * search expression not found ENDIF