Skip to contents

Validates whether a string contains a valid DOI format. Accepts DOIs with or without URL prefixes (https://doi.org/ or http://dx.doi.org/).

Usage

validate_doi_format(input_string)

Arguments

input_string

Character string to validate as DOI

Value

Logical indicating whether the input is a valid DOI format

Details

DOI format follows the pattern: 10.registrant/suffix Where registrant is typically 4+ digits and suffix can contain various characters. This function validates format only, not whether the DOI actually exists.

Examples

validate_doi_format("10.1016/j.marpolbul.2022.01.001")
#> [1] TRUE
validate_doi_format("https://doi.org/10.1000/xyz123")
#> [1] TRUE
validate_doi_format("not-a-doi")
#> [1] FALSE