cargo add path2regexp
Similar to path-to-regex
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
```rust let re = path2regex::PathRegexBuilder::new("/test") .set_end(false) .build() .unwrap();
// expected: Captures({0: Some("/test"), "ENDWINDDELIMITER": Some("")}) // found: Captures({0: Some("/test"), "ENDWINDDELIMITER": Some("")}) println!("{:?}", re.captures("/test").unwrap()); // expected: Captures({0: Some("/test")}) // found: Captures({0: Some("/test/"), "ENDWINDDELIMITER": Some("")}) println!("{:?}", re.captures("/test/").unwrap()); // expected: Captures({0: Some("/test")}) // found: Captures({0: Some("/test/"), "ENDWINDDELIMITER": Some("/")}) println!("{:?}", re.captures("/test/route").unwrap()); ```