[][src]Function voca_rs::index::search

pub fn search(subject: &str, pattern: &str, from_index: usize) -> i8

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

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