diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-05-20 15:00:39 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-05-20 15:00:39 -0700 |
commit | 510dc33c55b1aa993fc3e0e7085184ecbda8ef04 (patch) | |
tree | 3ded1231d4d83094ebb8edd2ff1e9b072937bb7f /rust/src/identifiers.rs | |
parent | b888f2201f981a2e01026e53d5c6ba2d435e9506 (diff) | |
download | fatcat-510dc33c55b1aa993fc3e0e7085184ecbda8ef04.tar.gz fatcat-510dc33c55b1aa993fc3e0e7085184ecbda8ef04.zip |
allow versioned PMCID
Diffstat (limited to 'rust/src/identifiers.rs')
-rw-r--r-- | rust/src/identifiers.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/rust/src/identifiers.rs b/rust/src/identifiers.rs index fead4272..37305677 100644 --- a/rust/src/identifiers.rs +++ b/rust/src/identifiers.rs @@ -106,7 +106,7 @@ fn test_check_username() { pub fn check_pmcid(raw: &str) -> Result<()> { lazy_static! { - static ref RE: Regex = Regex::new(r"^PMC\d+$").unwrap(); + static ref RE: Regex = Regex::new(r"^PMC\d+(\.\d+)?$").unwrap(); } if raw.is_ascii() && RE.is_match(raw) { Ok(()) @@ -121,9 +121,12 @@ pub fn check_pmcid(raw: &str) -> Result<()> { #[test] fn test_check_pmcid() { assert!(check_pmcid("PMC12345").is_ok()); + assert!(check_pmcid("PMC12345.1").is_ok()); + assert!(check_pmcid("PMC12345.96").is_ok()); assert!(check_pmcid("PMC12345 ").is_err()); assert!(check_pmcid("PMC").is_err()); - assert!(check_pmcid("PMC1.2345").is_err()); + assert!(check_pmcid("PMC.3").is_err()); + assert!(check_pmcid("PMC1123.").is_err()); } pub fn check_pmid(raw: &str) -> Result<()> { |