lookAheadBoundary
Pattern that requires a given pattern to follow, without consuming it.
Category: Language Fundamentals > Data Types
Syntax
pat = lookAheadBoundary(p)
Matches a position that is followed by text matching p.
Description
A look-ahead lets a pattern depend on its context. 'cat' + lookAheadBoundary('fish') matches cat only when fish comes right after it, and returns just cat. The related lookBehindBoundary checks what comes before instead.
Input arguments
p- Pattern or text that must come next.
Output arguments
pat- A
patternobject of zero width: the text matched bypis checked but not included in the result.
Example
Match only before a context
s = 'catfish dogcat';
extract(s, 'cat' + lookAheadBoundary('fish'))
Output
ans = "cat"