as_path_to_pattern | R Documentation |
Identify a function as a path to pattern function; a function that accepts a path and returns a matching pattern.
as_path_to_pattern(path)
path |
A function that accepts a character vector of length 1 and returns another character vector of length 1. |
Object of class "pathToPattern".
fn <- function(path) {
pattern <- gsub(":([^/]+)", "(\\\\w+)", path)
paste0("^", pattern, "$")
}
path_to_pattern <- as_path_to_pattern(fn)
path <- "/dashboard/profile/:user_id"
pattern <- path_to_pattern(path) # "^/dashboard/profile/(\w+)$"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.