If you use these in R, make sure you specify perl = TRUE
, see
base::grep()
.
Details
Currently included:
pkg_name
: A valid package name.type_cran
: Acran::
package reference.type_bioc
: Abioc::
package reference.type_standard
: Astandard::
package reference.type_github
: Agithub::
package reference.type_git
: Agit::
package reference.type_local
: Alocal::
package reference.type_deps
: Adeps::
package reference.type_installed
: Aninstalled::
package reference.github_username
: A GitHub username.github_repo
: A GitHub repository name.github_url
: A GitHub URL.
Examples
pkg_rx()
#> $pkg_name
#> [1] "[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9]"
#>
#> $type_cran
#> [1] "^(?:cran::)?(?<package>[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])(?:@(?:(?:(?<atleast>>=)?(?<version>[0-9]+[-\\.][0-9]+(?:[-\\.][0-9]+)*|current|last))))?$"
#>
#> $type_bioc
#> [1] "^(?:bioc::)?(?<package>[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])(?:@(?:(?:(?<atleast>>=)?(?<version>[0-9]+[-\\.][0-9]+(?:[-\\.][0-9]+)*|current|last))))?$"
#>
#> $type_standard
#> [1] "^(?:standard::)?(?<package>[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])(?:@(?:(?:(?<atleast>>=)?(?<version>[0-9]+[-\\.][0-9]+(?:[-\\.][0-9]+)*|current|last))))?$"
#>
#> $type_github
#> [1] "^(?:(?<package>[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])=)?(?:github::)?(?<username>(?:[a-zA-Z\\d](?:[a-zA-Z\\d-]){0,38}))/(?<repo>[^/@#]+)(?:/(?<subdir>(?:[^@#]*[^@#/])/?))?(?:(?:(?:@(?<commitish>[^*].*)))|(?:(?:#(?<pull>[0-9]+)))|(?:(?:@(?<release>[*]release))))?$"
#>
#> $type_git
#> [1] "^(?:(?<package>[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])=)?(?:git::)(?:(?<protocol>[^/]*)://)?(?<host>[^/]+)(?<path>[^@]*/)(?<repo>[^/@]*)(?:@(?<commitish>.*))?"
#>
#> $type_local
#> [1] "^(?:(?<package>[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])=)?(?|local::(?<path>.*)|(?<path>(?:/|\\\\|~|[.]/|[.]\\\\|[.]$).*))$"
#>
#> $type_deps
#> [1] "^(?:deps::)(?<path>.*)$"
#>
#> $type_installed
#> [1] "^(?:installed::)?(?<library>.*)/(?<package>[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])$"
#>
#> $github_username
#> [1] "(?<username>(?:[a-zA-Z\\d](?:[a-zA-Z\\d-]){0,38}))"
#>
#> $github_repo
#> [1] "(?<repo>[^/@#]+)"
#>
#> $github_url
#> [1] "^(?:(?<package>[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9])=)?(?:github::)?(?:(?:https?://)|(?:(?:ssh://|[^@]+@)))(?:[^/:]+)[/:](?<username>(?:[a-zA-Z\\d](?:[a-zA-Z\\d-]){0,38}))/(?<repo>[^/@#]+?)(?<subdir>)(?:[.]git)?(?:/(?:(?:(?:tree|commit|releases/tag)/(?<commitish>.+$))|(?:pull/(?<pull>.+$))|(?:releases/)(?<release>.+$)))?$"
#>