This repository was archived by the owner on Oct 6, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
main/java/gov/osti/services
test/java/gov/osti/services Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ public class Validation {
112112 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,})$" );
113113 protected static final Pattern URL_PATTERN = Pattern .compile ("\\ bhttps?://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]" );
114114 protected static final Pattern DOI_PATTERN = Pattern .compile ("10.\\ d{4,9}/[-._;()/:A-Za-z0-9]+$" );
115- protected static final Pattern ORCID_PATTERN = Pattern .compile ("(?i)^\\ s*(?:(?:https?:\\ /\\ /)?orcid\\ .org\\ /)?(\\ d{4}(?:-?\\ d{4}){3} )\\ s*$" );
115+ protected static final Pattern ORCID_PATTERN = Pattern .compile ("(?i)^\\ s*(?:(?:https?:\\ /\\ /)?orcid\\ .org\\ /)?(\\ d{4}(?:-?\\ d{4}){2}(?:-? \\ d{3}[ \\ dX]) )\\ s*$" );
116116
117117 @ JsonIgnoreProperties (ignoreUnknown = true )
118118 private static class ValidationRequest implements Serializable {
@@ -193,7 +193,7 @@ private static String stripBaseORCID(String value) {
193193
194194 if (matcher .find ())
195195 // return matching 16 digit characters
196- return matcher .group (1 ).replaceAll ("-" , "" );
196+ return matcher .group (1 ).replaceAll ("-" , "" ). replaceAll ( "x" , "X" ) ;
197197 else
198198 // no valid ORCID pattern
199199 return null ;
Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ public void testIsValidORCID() {
145145 };
146146 // valid DOI patterns
147147 String [] valid = { "0000000218250097" , "0000-0003-3348-0736" ,
148- "HTTPS://orcid.org/0000-0001-8811-2688" , " 00000003-33480736 "
148+ "HTTPS://orcid.org/0000-0001-8811-2688" , " 00000002-5667291x "
149149 };
150150
151151 for ( String orcid : invalid ) {
You can’t perform that action at this time.
0 commit comments