Searching for a pattern
FileDocumentLib.FileDocument fdoc = new FileDocumentLib.FileDocument();
FileDocumentLib.IMultiSelection msec = fdoc.CreateEmptySelection();
fdoc.Open(@"c:\temp\file.txt");
msec.AddRange(0, fdoc.FileSize); // We'll be searching in a whole file
byte[] pattern = new byte[] { 0x0d, 0x0a }; // EOL pattern
ulong EOL_Offset = fdoc.Find(ref pattern[0], pattern.Length, msel, 0, false, false);
// ...
// continue searching
EOL_Offset = fdoc.Find(ref pattern[0], pattern.Length, msel, EOL_Offset + 1, false, false);