Crates.io | simple-text-pattern |
lib.rs | simple-text-pattern |
version | 0.1.0 |
source | src |
created_at | 2019-04-16 21:58:18.523697 |
updated_at | 2019-04-16 21:58:18.523697 |
description | Matching simple text patterns. |
homepage | |
repository | https://github.com/svmk/simple-text-pattern |
max_upload_size | |
id | 128460 |
size | 11,243 |
This crate provides a library for compiling and matching simple text patterns.
Passed pattern some*text
will be compiled into equivalent regexp ^some.*text$
.
*
- one or more any symbol.any other text
- interpreted as simple text.use simple_text_pattern::Pattern;
let pattern = Pattern::new("some*text").expect("Unable to compile pattern");
assert_eq!(true, pattern.is_match("sometext"));
assert_eq!(true, pattern.is_match("some text"));
assert_eq!(false, pattern.is_match("not some text"));