Turn a URL Pathname into a Regular Expression

R's implementation of the JavaScript library 'path-to-regexp', it aims to provide R web frameworks features such as parameter handling among other URL path utilities.


pater

The goal of pater is to decompose a given pathname into meaningful tokens that will be later used to construct a regular expression useful when matching an HTTP request to a route handler.

Core to this are path parameters which are pieces of text you define in your route definitions and that will be filled when a new request comes in, they are useful because they act as identifiers for a given concept you care about.

Path parameters can appear anywhere you want inside a given path, they may share the same path segment or be next to plain text, given this the following are valid positions for path parameters:

  • /text/:parameter
  • /text/:parameter1-:parameter2
  • /text1/:parameter1/text2{.:parameter2}
  • /text1/*parameter

pater borrows its syntax from the original path-to-regexp implementation that you can read, understand and experiment with pater in R as the R implementation tries to be as close as possible to the original.

Installation

You can install the development version of pater like so:

# install.packages("pak")
# pak::pak("JulioCollazos64/pater")

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("pater")

1.0.0 by Julio Collazos, 10 months ago


https://github.com/JulioCollazos64/pater


Report a bug at https://github.com/JulioCollazos64/pater/issues


Browse source code at https://github.com/cran/pater


Authors: Julio Collazos [aut, cre] , path-to-regexp contributors [cph] (see <https://github.com/pillarjs/path-to-regexp/graphs/contributors>)


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports utils

Suggests testthat, stringr


Imported by routing.


See at CRAN