# UTILS
# Pattern matching & composition ----
# ===================================
reg_match = function(string, pattern)
regmatches(string, regexpr(pattern, string))
reg_fun = function(x)
paste0("^(.*::)*(", paste(x, collapse = "|"), ")")
reg_suffix = function(x)
paste0("\\.(", paste(x, collapse = "|"), ")$")
# File name operations ----
# =========================
file_suffix = function(file) {
if (inherits(file, "list"))
file = unlist(file, use.names = F)
reg_match(file, "[^\\.]+$")
}
file_bare = function(file) {
if (inherits(file, "list"))
file = unlist(file, use.names = F)
reg_match(file, "[^/]+$")
}
file_path = function(file) {
if (inherits(file, "list"))
file = unlist(file, use.names = F)
gsub("[^/]+$", "", file)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.