Pattern
trait Pattern<P> Import
Source: use text::{Pattern}; src/text.hy Something a [Searchable] value can be searched for: a plain string (matched literally), or a type such as coil-regex’s Regex.
Spans are byte offsets into the searched string, on
character boundaries. Searching from from finds the leftmost match that
starts at or after from.
Required methods#
| Name | Description |
|---|---|
find_in | Returns the span of the leftmost match in hay at or after byte from. |
is_prefix_of | Returns true when a match starts at the beginning of hay. |
is_suffix_of | Returns true when a match ends at the end of hay. |
expand | Returns the replacement text for the match find_in just returned. |
Examples#
use text::{Pattern, Span};
use tests::assert;
let at = "-".find_in("a-b-c", 2) ?? new Span(0, 0);
assert!(at.start == 3 && at.end == 4);