[][src]Function voca_rs::query::matches

pub fn matches(subject: &str, pattern: &str, position: usize) -> bool

Checks whether subject matches the regular expression pattern. NOTE: Executes regular expressions only on valid UTF-8 while exposing match locations as byte indices into the search string (see case #4).

Arguments

Example

use voca_rs::*;
query::matches("pluto", "a", 0);
// => false
query::matches("pluto", r"plu.{2}", 0);
// => true
query::matches("apollo 11", r"\d{3}", 0);
// => false
query::matches("Zażółć gęślą jaźń", "gęślą", 11);
// => true (because "gęślą" starts from 11 not 7)
use voca_rs::Voca;
"pluto"._matches(r"plu.{2}", 0);
// => true