Crates.io | route-pattern |
lib.rs | route-pattern |
version | 0.2.0 |
source | src |
created_at | 2022-11-08 18:25:05.64701 |
updated_at | 2022-11-23 17:38:21.417823 |
description | A parser and matcher for route patterns |
homepage | |
repository | https://github.com/jondot/route-pattern |
max_upload_size | |
id | 708189 |
size | 17,282 |
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.