Strings and mutable buffers offer methods to find the first (last) occurrence of a needle in a haystack. At the moment the search starts at the beginning (end) or at a defined position and continue until a match was found or the end of string was reached.
Whilst working on the mutable buffer section class I found out that the pos does not need to search on areas that are hidden from the section. To achieve this the pos and lastpos methods would need a third optional argument that specifies the number of character to be searched.
string~pos(needle, start, length) -- same with lastpos
The same methods could be added to the mutable buffer (implementation is done in the StringClassMisc anyway).
Another remark: would it be possible to use a more efficient algorithm to search? At the moment each possible start of the needle is checked with a strcmp call. A faster approach would be to use an algorithm like KMP or Boyer–Moore.