4 releases
0.0.4 | Dec 2, 2022 |
---|---|
0.0.3 | Nov 20, 2022 |
0.0.2 | Nov 20, 2022 |
0.0.1 | Nov 20, 2022 |
0.0.0-alpha |
|
#839 in Text processing
53KB
1.5K
SLoC
Path-to-RegExp
Installation
cargo add path2regex
Features
Usage
Similar to path-to-regex
Differences
Thought that regex was not supported ?=
,The performance of the end
and ends_with
property in the configuration item will vary.
notice: regex executes captures
to get the result, providing the name END_WITH_DELIMITER
matching group to handle the extra endings
let re = path2regex::PathRegexBuilder::new("/test")
.set_end(false)
.build()
.unwrap();
// expected: Captures({0: Some("/test")})
// found: Captures({0: Some("/test"), "END_WIND_DELIMITER": Some("")})
println!("{:?}", re.captures("/test").unwrap());
// expected: Captures({0: Some("/test")})
// found: Captures({0: Some("/test/"), "END_WIND_DELIMITER": Some("")})
println!("{:?}", re.captures("/test/").unwrap());
// expected: Captures({0: Some("/test")})
// found: Captures({0: Some("/test/"), "END_WIND_DELIMITER": Some("/")})
println!("{:?}", re.captures("/test/route").unwrap());
Dependencies
~2.2–3.5MB
~61K SLoC