# The Amazing Mustermann [](https://github.com/sinatra/mustermann/actions/workflows/test.yml) [](https://coveralls.io/github/sinatra/mustermann?branch=main) [](https://rubygems.org/gems/mustermann) [](http://inch-ci.org/github/rkh/mustermann) [](https://gemdocs.org/gems/mustermann/) [](http://rkh.mit-license.org) [](http://img.shields.io) This repository contains two projects (each installable as separate gems): * **[mustermann](https://github.com/sinatra/mustermann/blob/main/mustermann/README.md): Your personal string matching expert. This is probably what you're looking for.** * [mustermann-contrib](https://github.com/sinatra/mustermann/blob/main/mustermann-contrib/README.md): A gem with additional pattern types and extensions. ## Projects using Mustermann Mustermann is typically used by other frameworks and libraries, primarily but not exclusively for handing HTTP requests. These include, amongst others: * [Sinatra](https://sinatrarb.com/): A DSL for quickly creating web applications with minimal effort * [Hanami](https://hanamirb.org/): A flexible framework for maintainable Ruby apps * [Grape](https://www.ruby-grape.org/): An opinionated framework for creating REST-like APIs in Ruby. * [Padrino](http://padrinorb.com/): A Ruby web framework built upon Sinatra. * [Praxis](https://github.com/praxis/praxis): A framework that focuses on both the design and implementation aspects of creating APIs. * [Webspicy](https://yourbackendisbroken.dev/): A technology agnostic specification and test framework that yields better coverage for less testing effort. * [Alchemrest](https://github.com/Betterment/alchemrest): Betterment's library for building robust, reliable, performant integrations with third party APIs, with a focus on making APIs work with the rest of your domain layer not against it. * [HTTP Fake](https://alchemists.io/projects/http-fake): An HTTP fake implementation for test suites. * [oas_parser](https://github.com/Nexmo/oas_parser) and [oas_parser_reborn](https://github.com/MarioRuiz/oas_parser_reborn): An open source Open API Spec 3 Definition Parser * [Pendragon](https://github.com/namusyaka/pendragon): Provides an HTTP router and its toolkit for use in Rack. As a Rack application, it makes it easy to define complicated routing. * [Wayferer](https://rubygems.org/gems/wayfarer): Web crawling framework based on ActiveJob. * [apiculture](https://rubygems.org/gems/apiculture): A toolkit for building REST APIs on top of Rack. By WeTransfer. ## Git versions with Bundler You can easily use the latest edge version from GitHub of any of these gems via [Bundler](http://bundler.io/): ``` ruby github 'sinatra/mustermann' do gem 'mustermann' gem 'mustermann-contrib' end ``` ## Pattern Types The `identity`, `regexp`, `rails`, and `sinatra` types are included in the `mustermann` gem, all the other types listed here are part of the `mustermann-contrib` gem. There are also third-party gems providing additional types, like [mustermann-grape](https://github.com/ruby-grape/mustermann-grape).
| Type | Example | Compatible with | Notes |
|---|---|---|---|
| cake | /:prefix/** | CakePHP | |
| express | /:prefix+/:id(\d+) | Express, pillar.js | |
| flask | /<prefix>/<int:id> | Flask, Werkzeug | |
| identity | /image.png | any software using strings | Exact string matching (no parameter parsing). |
| pyramid | /{prefix:.*}/{id} | Pyramid, Pylons | |
| rails | /:slug(.:ext) | Ruby on Rails, Journey, HTTP Router, Hanami, Scalatra (if configured), NYNY | |
| regexp | /(?<slug>[^\/]+) | Oniguruma, Onigmo, regular expressions |
Created when you pass a regexp to Mustermann.new. Does not support expanding or generating templates. |
| shell | /*.{png,jpg} | Unix Shell (bash, zsh) | Does not support expanding or generating templates. |
| simple | /:slug.:ext | Sinatra (1.x), Scalatra, Dancer, Finatra, Spark, RCRouter, kick.js |
Implementation is a direct copy from Sinatra 1.3. It is the predecessor of sinatra. Does not support expanding or generating templates. |
| sinatra | /:slug(.:ext)? | Sinatra (2.x), Padrino (>= 0.13.0), Pendragon, Angelo |
This is the default and the only type "invented here". It is a superset of simple and has a common subset with template (and others). |
| uri-template | /{+pre}/{page}{?q} | RFC 6570, JSON API, JSON Home Documents and many more | Standardized URI templates, can be generated from most other types. |