Skip to content

Lookaround

bcql_py.models.lookaround

Regex-based lookahead and lookbehind assertions require special handling. Note that these occur outside of string literals but are lookarounds on Node values.

LookaheadNode

Bases: BCQLNode

A lookahead assertion: (?=...) (positive) or (?!...) (negative).

Matches a position only if the enclosed query matches (or doesn't match) the tokens that follow.

Attributes:

Name Type Description
positive bool

True for (?= ...), False for (?! ...).

body BCQLNodeUnion

The sub-query that must (or must not) match ahead.

LookbehindNode

Bases: BCQLNode

A lookbehind assertion: (?<=...) (positive) or (?<!...) (negative).

Matches a position only if the enclosed query matches (or doesn't match) the tokens that precede

Attributes:

Name Type Description
positive bool

True for (?<=...), False for (?<!...).

body BCQLNodeUnion

The sub-query that must (or must not) match behind