r and tries again.
</p>

<p>
If we want to know where the pattern is in the string
(instead of knowing only that it is there somewhere),
we can add position captures to the pattern:
</p>
<pre class="example">
local I = lpeg.Cp()
function anywhere (p)
  return lpeg.P{ I * p * I + 1 * lpeg.V(1) }
end
</pre>

<p>
Another option for the search is like this:
</p>
<pre class="example">
local I = lpeg.Cp()
function anywhere (p)
  return (1 - lpeg.P(p))^0 * I * p * I
end
</pre>
<p>
Again the pattern has a straight 