lpeg.B

Matches patt n characters behind the current position, consuming no input

Prototype

lpeg.B (patt, n)

Description

Returns a pattern that matches only if the input string matches patt starting n positions behind the current position. (The default value for n is 1.) If the current position is less than or equal to n, this pattern fails.

Like the "and predicate", this pattern never consumes any input, independently of success or failure, and it never produces any capture.

The pattern patt cannot contain any open reference to grammar rules (see grammars).

(This is an experimental feature. There is a good chance it will change in future versions.)

Lua functions

Topics