A parser and matcher for route patterns in Rust 🦀

Overview

Route Pattern

github crates.io docs.rs build status

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:

  • Choose your delimiters: {, } or <, > or others
  • Compile into a Regex or try a match

Dependency

[dependencies]
route-pattern = "0.1.0"

For most recent version see crates.io

Usage

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

Copyright (c) 2022 @jondot. See LICENSE for further details.

You might also like...
lemmy-help is a emmylua parser as well as a CLI which takes that parsed tree and converts it into vim help docs.
lemmy-help is a emmylua parser as well as a CLI which takes that parsed tree and converts it into vim help docs.

lemmy-help is a emmylua parser as well as a CLI which takes that parsed tree and converts it into vim help docs.

A parser and evaluator of spreadsheet-like formulas

Formula A parser and evaluator of spreadsheet-like formulas Formula is in its early stages, so it's better to be used cautiously. So far we have the f

SP3 Precise GNSS Orbit and Clock parser :artificial_satellite:

SP3 SP3 Precise GNSS Orbit files parser. SP3 is specifid by IGS. The parser only supports Revisions C & D at the moment and rejects revisions A & B. G

A parser combinator that is fully statically dispatched and supports both sync/async.

XParse A parser combinator that is fully statically dispatched and supports both sync & async parsing. How to use An example of a very simple JSON par

A device-tree source parser, analyzer and language server.

Ginko A device-tree source parser, analyzer and language server. The main goal of this project is to make working with device-trees easy. For example,

A full featured, fast Command Line Argument Parser for Rust

clap Command Line Argument Parser for Rust It is a simple-to-use, efficient, and full-featured library for parsing command line arguments and subcomma

Docopt for Rust (command line argument parser).

THIS CRATE IS UNMAINTAINED This crate is unlikely to see significant future evolution. The primary reason to choose this crate for a new project is if

A full featured, fast Command Line Argument Parser for Rust

clap Command Line Argument Parser for Rust It is a simple-to-use, efficient, and full-featured library for parsing command line arguments and subcomma

Simple command line flag parser for rust.

easy_flag Simple command line flag parser for rust. use easy_flag::FlagSet; fn main() - Result(), String{ let mut help = false; let mut my

Owner
Dotan J. Nahum
Dotan J. Nahum
Count your code by tokens, types of syntax tree nodes, and patterns in the syntax tree. A tokei/scc/cloc alternative.

tcount (pronounced "tee-count") Count your code by tokens, types of syntax tree nodes, and patterns in the syntax tree. Quick Start Simply run tcount

Adam P. Regasz-Rethy 48 Dec 7, 2022
Shellfirm - Intercept any risky patterns (default or defined by you) and prompt you a small challenge for double verification

shellfirm Opppppsss you did it again? ?? ?? ?? Protect yourself from yourself! rm -rf * git reset --hard before saving? kubectl delete ns which going

elad 652 Dec 29, 2022
Service-Oriented Design Patterns for Rust

SOD: Service-Oriented Design Overview This crate provides Service, MutService, and AsyncService traits and associated utilities to facilitiate service

Eric Thill 3 Apr 26, 2023
Game of life rendered in your terminal with over 500+ unique patterns to choose from.

Controls a: play animation n: next generation s: stop j or down arrow: go down next pattern (note: you have to stop the animation to browse the patter

Omar Magdy 20 Dec 22, 2022
List key patterns of a JSON file for jq.

jqk jqk lists key patterns of a JSON file for jq. Why? jq is a useful command line tool to filter values from a JSON file quickly on a terminal; howev

Kentaro Wada 8 Jun 25, 2023
Extract patterns from unstructured log messages

logu logu is for extracting patterns from (streaming) unstructured log messages. For parsing unstructured logs, it uses the parser from Drain. In simp

null 78 Oct 21, 2024
A language parser tool to build recursive descent top down parser.

lang-pt A language parser tool to generate recursive descent top down parser. Overview Parsers written for the languages like Javascript are often cus

Creative Forest 7 Jan 4, 2023
Pure-Rust rewrite of the Linux fontconfig library (no system dependencies) - using ttf-parser and allsorts

rust-fontconfig Pure-Rust rewrite of the Linux fontconfig library (no system dependencies) - using allsorts as a font parser in order to parse .woff,

Felix Schütt 28 Oct 29, 2022
A simple, lightweight and extensible command line argument parser for rust codebases

A simple, lightweight and extensible command line argument parser for rust codebases. This crate aims to provide you with an easy-to-use and extensibl

Victor Ndaba 20 Nov 12, 2022
Shiva library: Implementation in Rust of a parser and generator for documents of any type

Shiva Shiva library: Implementation in Rust of a parser and generator for documents of any type Features Common Document Model (CDM) for all document

Igumnoff Software 149 Jul 25, 2024