Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit c3adbf4

Browse files
author
sowerstl
committed
Update DOI RegEx pattern to be more restrictive.
1 parent a8eb02d commit c3adbf4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/gov/osti/services/Validation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public class Validation {
110110
// regular expressions for validating email addresses and URLs
111111
protected static final Pattern EMAIL_PATTERN = Pattern.compile("^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
112112
protected static final Pattern URL_PATTERN = Pattern.compile("\\bhttps?://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]");
113-
protected static final Pattern DOI_PATTERN = Pattern.compile("10.\\d{4,9}/[-._;()/:A-Za-z0-9]+$");
113+
protected static final Pattern DOI_PATTERN = Pattern.compile("^(?i)(?:doi:|https?:\\/\\/(?:dx[.])?doi[.]org\\/)?10.\\d{4,9}\\/[-._;()\\/:A-Za-z0-9]+$");
114114
protected static final Pattern ORCID_PATTERN = Pattern.compile("(?i)^\\s*(?:(?:https?:\\/\\/)?orcid\\.org\\/)?(\\d{4}(?:-?\\d{4}){2}(?:-?\\d{3}[\\dX]))\\s*$");
115115

116116
@JsonIgnoreProperties (ignoreUnknown = true)

0 commit comments

Comments
 (0)