This function checks if the input url
contains a valid Digital Object
Identifier (DOI) using a regular expression.
If a valid DOI is found, it extracts the DOI and optionally returns either
the DOI string or the full DOI URL.
Details
The function uses a regular expression to search for a DOI in the
input. It leverages an external function
GoFish
(with type = FALSE
) to perform additional checks.
The DOI is then trimmed using a function called
Trim
. The regular expression pattern is designed to match the
standard DOI format.
Examples
if (FALSE) { # \dontrun{
# Example 1: Extract full DOI URL from a string containing a DOI
doi_url <- CheckDoi("https://doi.org/10.1000/xyz123")
# doi_url will be "https://doi.org/10.1000/xyz123"
# Example 2: Extract only the DOI without the URL prefix
doi_only <- CheckDoi("10.1000/xyz123", doi.only = TRUE)
# doi_only will be "10.1000/xyz123"
} # }