Skip to content

Commit

Permalink
Merge pull request #56 from MITLibraries/tco42-pmid-with-no-spaces
Browse files Browse the repository at this point in the history
Updates PMID detection regex
  • Loading branch information
JPrevost authored Jul 11, 2024
2 parents df7a3ea + d07a583 commit 17eaf43
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/standard_identifiers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def term_patterns
{
isbn: /\b(ISBN-*(1[03])* *(: ){0,1})*(([0-9Xx][- ]*){13}|([0-9Xx][- ]*){10})\b/,
issn: /\b[0-9]{4}-[0-9]{3}[0-9xX]\b/,
pmid: /\b((pmid|PMID): (\d{7,8}))\b/,
pmid: /\b((pmid|PMID):\s?(\d{7,8}))\b/,
doi: %r{\b10\.(\d+\.*)+/(([^\s.])+\.*)+\b}
}
end
Expand Down
2 changes: 1 addition & 1 deletion test/models/standard_identifiers_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class StandardIdentifiersTest < ActiveSupport::TestCase
end

test 'pmid examples' do
samples = ['PMID: 35648703', 'pmid: 1234567']
samples = ['PMID: 35648703', 'pmid: 1234567', 'PMID:35648703']

samples.each do |pmid|
actual = StandardIdentifiers.new(pmid).identifiers
Expand Down

0 comments on commit 17eaf43

Please sign in to comment.