Simple regex engine implementation in Rust using Automatas.
- Or
a|b- Matches "a" or "b". - And
ab- Matches "a" and "b", theAndoperator is implicit. - ClosureStar
a*- Matches zero or more "a". - ClosurePlus
a+- Matches one or more "a". - Character Class
[a-zA-Z]- Allow the creation of ranges and theOroperator is implicit inside the Character Class, the example is matching one literal between "a" and "z", or "A" and "Z" inclusive. - Ranges
[a-z]- Matches one literal between "a" and "z" inclusive. - Dot
.- Matches a single UTF-8 char.
use regex::regex::Regex;
fn main() {
let re = Regex::new("[a-z]").unwrap();
assert!(!re.is_match(""));
assert!(!re.is_match("aa"));
assert!(re.is_match("a"));
assert!(re.is_match("z"));
}