The string command position lets you find the exact location of the first character of a matching string. However, the limitation of the text type is 32K characters. So if you want to search through a file, you might have to open the document as a blob and break it up into smaller chunks of text.
This might not be the best approach because the string you are trying to search for might be broken up between blobs, so you might never find the string even if it is there!
The better solution then, is to search directly in a blob for the string. The following method called FindInBlob, will find a matching string in a blob and return its position in the blob:
For ($offset;0;BLOB size($blob)-1)
For ($i;$offset;BLOB size($blob)-1)
Suppose you had a blob of text of the text string "Hello, World!":
DOCUMENT TO BLOB("mytext.txt";$myBlob)
The result of $position would then be 7 (blob indices start at 0).