A parser and matcher for route patterns in Rust 🦀
APACHE-2.0 License
A parser and matcher for a popular way to create route patterns.
Patterns like these that include regular expressions, delimited in this case by {
and }
:
/users/{[0-9]+}/update
Supports nested curlies here (inner curlies are serving the regular expression):
/users/{[0-9]{1,8}}/update
It lets you:
{
, }
or <
, >
or othersRegex
or try a match[dependencies]
route-pattern = "0.1.0"
For most recent version see crates.io
let answer = route_pattern::is_match("foo/{b{1,4}}/{[0-9]+}", '{', '}', "foo/bbb/123")?
Or get a Regex
and use it later
let re = route_pattern::compile("foo/{b{1,4}}/{[0-9]+}", '{', '}')?;
Copyright (c) 2022 @jondot. See LICENSE for further details.