Skip to main content

Module search

Module search 

Source
Expand description

Text search helpers.

This module provides simple search APIs over a UTF-8 &str, using character offsets (not byte offsets) for all public inputs/outputs. It supports:

  • plain substring search (escaped and compiled into a regex)
  • regex search
  • optional whole-word matching

Structs§

SearchMatch
A match returned by the search APIs, expressed as a half-open character range.
SearchOptions
Options that control how search is performed.

Enums§

SearchError
Search errors.

Functions§

find_all
Find all occurrences of query in text.
find_next
Find the next occurrence of query in text, searching forward from from_char.
find_prev
Find the previous occurrence of query in text, searching backward from from_char.
is_match_exact
Returns true if range exactly matches an occurrence of query in text.