Skip to content

Commit

Permalink
Updates PMID detection regex
Browse files Browse the repository at this point in the history
Why are these changes being introduced:

* The regex was missing PMIDs with no space between the `PMID:`
  and the indentifier, such as `PMID:35648703`

Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/TCO-42

How does this address that need:

* Updates regex to allow, but not require, a single whitespace character
  between `pmid:` and the indentifier

* Updates a local fallback favicon
* Removes some unused additional favicons
  • Loading branch information
JPrevost committed Jul 10, 2024
1 parent 69fe1f1 commit 3215744
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 3215744

Please sign in to comment.