interface Pattern
pub interface Pattern
What a text is searched for: a view or a string, a character, a test of characters.
One signature per operation takes any of them: contains(p), split(p), stripPrefix(p) …
Two primitives work over byte indices of text: matchAt returns the end of a match that
begins at at, matchBefore the start of a match that ends at end, null where there is
none. at and end are a character's first byte or the text's length. A third, nextIn,
finds where the next match begins; its default walks the first bytes with matchAt, and a
pattern that can find faster (a view, a string) overrides it.
Methods
fn matchAt(text: StringView, at: int): ?int
fn matchBefore(text: StringView, end: int): ?int
fn nextIn(text: StringView, from: int): ?int
Returns the first byte at or after from where a match begins, or null.
The byte is a character's first byte or the length.