Expand description
Returns the first index of a pattern
match in subject
.
NOTE: Executes regular expressions only on valid UTF-8 while exposing match locations as byte indices into the search string (see case #3).
Arguments
subject
- The string where to search.pattern
- The RegExp pattern to search, it is transformed to Regex::new(pattern).from_index
- The index to start searching.
Example
use voca_rs::*;
index::search("morning", "rn", 0);
// => 2
index::search("evening", r"\d", 0);
// => -1
index::search("Zażółć gęślą jaźń", "gęślą", 6);
// => 11 (substring's position in `subject`), not 7
use voca_rs::Voca;
"morning"._search("rn", 0);
// => 2