> I forgot the 'i': > > if str:find('^'..sub,i) then ... end This is seems faster than my suggestion but it does create a new string, which the OP seems to want to avoid. My suggestion can be slow if str is *very* long.