Description Usage Arguments Value Examples
View source: R/extensionRegExp.R
For a given list extensions
of file extensions, e.g.,
c("txt", "csv")
or just a single file extension, this function
creates a regular expression while will match a file path that ends in any
of the extensions (with a leading ".").
1 | path.extensionRegExp(extensions, before.extension = NULL)
|
extensions |
either a single string or array of strings, each holding a file extension |
before.extension |
a string required to occur immediately before the file extension |
the regular expression which will match them
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | exp <- path.extensionRegExp(c("html", "jpg"))
exp
# [1] "^.*\\.(html|jpg)$"
length(grep(exp, "hellojpg")) > 0L
# [1] FALSE
length(grep(exp, "hello.jpg")) > 0L
# [1] TRUE
length(grep(exp, "hello.html")) > 0L
# [1] TRUE
length(grep(exp, "hellohtml")) > 0L
# [1] FALSE
length(grep(exp, "hello.htm")) > 0L
# [1] FALSE
length(grep(exp, "hello.html.txt")) > 0L
# [1] FALSE
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.