From 8ab682d5d64fb5a23a65fcf9a3441bb0b8876694 Mon Sep 17 00:00:00 2001 From: Kim Rutherford Date: Wed, 13 Nov 2024 12:28:57 +1300 Subject: [PATCH] Search box: cope with weird PMID formatting Handle things like "PMID 38830897", "PubMed_38830897" or "PMID38830897". Refs pombase/website#2275 --- src/app/search-box/search-box.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/search-box/search-box.component.ts b/src/app/search-box/search-box.component.ts index 372a52e3..bf2e3ea8 100644 --- a/src/app/search-box/search-box.component.ts +++ b/src/app/search-box/search-box.component.ts @@ -482,12 +482,15 @@ export class SearchBoxComponent implements OnInit { } observableFromToken(token: string): Observable> { + token = token.trim(); let observables = []; const geneSummaryObservable = of(this.summariesFromToken(token)); observables.push(geneSummaryObservable); token = token.replace(this.sysGeneIdRe, '').replace(this.sysTranscriptIdRe, '').trim(); - token = token.replace(/^PMID: +/, 'PMID:'); // handle copy and paste from PubMed pages + + // handle copy and paste from PubMed pages, and other weird things that happen to PMIDs + token = token.replace(/^(PMID|PubMed)[: _\-]*/i, 'PMID:'); if (token.length > 0) { // for now we filter out systematic IDs because they cause Lucene problems