digitBoundary
Pattern that matches the boundary between a digit and a non-digit.
Category: Language Fundamentals > Data Types
Syntax
pat = digitBoundary
A zero-width pattern at a digit boundary.
Description
A boundary exists where a digit is next to a character that is not a digit, or where a digit is at the start or end of the text. Like \b in regular expressions, it consumes no text and is used to anchor another pattern, for example to demand that a run of digits is not part of a longer word such as x12.
Output arguments
pat- A
patternobject that matches no characters, only a position.
Example
Anchoring digits
extract('ab 12 cd', digitBoundary + digitsPattern + digitBoundary)
Output
ans = "12"
Notes
Used on its own, as in extract(txt, digitBoundary), MatLivre returns empty matches; combine it with other patterns.