How about this? s='the quick brown fox jumps over the lazy dog' w='the' print(s:find(w)) -- first match (position is first return value) print(s:find('.*()'..w)) -- last match (position is third return value)