Module ev

Module ev 

Source
Available on (crate features syntax-glob or syntax-ev or syntax-regex) and crate feature syntax-ev only.
Expand description

§IbEverythingExt flavour

Parse a pattern according to the syntax used by IbEverythingExt.

See Pattern::parse_ev.

§Example

// cargo add ib-matcher --features syntax-ev,pinyin
use ib_matcher::{matcher::{IbMatcher, PinyinMatchConfig, pattern::Pattern}, pinyin::PinyinNotation};

let matcher = IbMatcher::builder(Pattern::parse_ev("pinyin;py").call())
    .pinyin(PinyinMatchConfig::notations(PinyinNotation::Ascii))
    .build();
assert!(matcher.is_match("拼音搜索"));
assert!(matcher.is_match("pinyin") == false);

§With Regex

use ib_matcher::{regex::lita::Regex, matcher::{MatchConfig, pattern::Pattern}};

let re = Regex::builder()
    .ib(MatchConfig::builder().pinyin(Default::default()).build())
    .ib_parser(&mut |pattern| Pattern::parse_ev(pattern).call())
    .build("pinyin;py")
    .unwrap();
assert!(re.is_match("拼音搜索"));
assert!(re.is_match("pinyin") == false);

§With glob

use ib_matcher::{
    matcher::{MatchConfig, pattern::Pattern},
    regex::lita::Regex,
    syntax::glob::{parse_wildcard_path, PathSeparator}
};

let re = Regex::builder()
    .ib(MatchConfig::builder().pinyin(Default::default()).build())
    .ib_parser(&mut |pattern| Pattern::parse_ev(pattern).call())
    .build_from_hir(
        parse_wildcard_path()
            .separator(PathSeparator::Windows)
            .call(r"pinyin;py**sou;py"),
    )
    .unwrap();
assert!(re.is_match(r"C:\拼音\System32\搜索.exe"));
assert!(re.is_match(r"C:\pinyin\System32\搜索.exe") == false);
assert!(re.is_match(r"C:\pinyin\System32\sousuo.exe") == false);

Structs§

PatternParseEvBuilder
Use builder syntax to set the inputs and finish with call().