Files @ 9e303d5ff83e
Branch filter:

Location: Regular-Expresso/src/main.rs - annotation

9e303d5ff83e 443 B application/rls-services+xml Show Source Show as Raw Download as Raw
Laman
removed Plus, made it an alias of the Alternative op
use regexp::Regexp;

fn main() {
	let tests = ["", "a", "ab", "aabb", "abab", "abcd", "abcbcdbcd"];
	for pattern in ["a(b|c)", "a*b*", "a+b+", "(ab)*", "(ab)+", "a((bc)*d)*"] {
		println!("# {pattern}");
		let r = match Regexp::new(&pattern.to_string()) {
			Ok(r1) => r1.determinize(),
			Err(e) => {
				println!("{e}");
				continue;
			}
		};
		for &t in tests.iter() {
			println!("{t} {}", r.eval(t.to_string()));
		}
		println!();
	}
}