Expand description
This crate provides a library for parsing, compiling, and executing text expressions. The text expression syntax is kind of limited if compared to regular expressions, but maintains a high readability in exchange. It’s not the goal of the text expression language to replace regular expression – it’s meant to fill the lack of readability for simple tasks
The text expression language was created in combination with the ter cli, a text expression runner to make the execution and common usecases of text expressions as easy as possible
This crate’s documentation provides some simple examples, describes the supported syntax exhaustively.
For more specific details on text expressions, please see the documentation for the
TextExpression
struct.
§Examples
§5 digit numbers
let expr = srch::Expression::new(&"numeric and length 5".to_owned()).unwrap();
assert!(expr.matches("12345"));
§Naive email addresses
let expr = srch::Expression::new(&"contains \"@\" and contains \".com\"".to_owned()).unwrap();
assert!(expr.matches("foo@baz.com"));