From b2749bf5256f061337bad414d406aa7dff7a9dd7 Mon Sep 17 00:00:00 2001 From: David Wheatley Date: Fri, 16 Feb 2024 23:03:58 +0000 Subject: [PATCH] fix: bad regex --- src/components/AmeyLiveTrainAnnouncements.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/AmeyLiveTrainAnnouncements.tsx b/src/components/AmeyLiveTrainAnnouncements.tsx index 4e6fd0310..b2cf1d55d 100644 --- a/src/components/AmeyLiveTrainAnnouncements.tsx +++ b/src/components/AmeyLiveTrainAnnouncements.tsx @@ -189,7 +189,7 @@ export function LiveTrainAnnouncements({ } // Remove CRS from end of label - return [s.label.toLowerCase().replace(/ ([A-Z0-9]{3})$/i, ''), s.value] + return [s.label.toLowerCase().replace(/ \([A-Z0-9]{3}\)$/i, ''), s.value] }) .filter(x => x) as [string, string][], ), @@ -405,7 +405,7 @@ export function LiveTrainAnnouncements({ const guessViaCrs = guessViaPoint(via.trim().toLowerCase(), train.subsequentLocations) addLog(`Guessed via ${guessViaCrs} for ${via}`) - console.log(`[Live Trains] Guessed via ${guessViaCrs} for ${via}`) + console.log(`[Live Trains] Guessed via ${guessViaCrs} for ${via.trim()}`) if (guessViaCrs && systems[systemKey].STATIONS.includes(guessViaCrs)) { const point = train.subsequentLocations.find(p => p.crs === guessViaCrs) @@ -496,7 +496,7 @@ export function LiveTrainAnnouncements({ const guessViaCrs = guessViaPoint(via.trim().toLowerCase(), train.subsequentLocations) addLog(`Guessed via ${guessViaCrs} for ${via}`) - console.log(`[Live Trains] Guessed via ${guessViaCrs} for ${via}`) + console.log(`[Live Trains] Guessed via ${guessViaCrs} for ${via.trim()}`) if (guessViaCrs && systems[systemKey].STATIONS.includes(guessViaCrs)) { const point = train.subsequentLocations.find(p => p.crs === guessViaCrs) @@ -631,7 +631,7 @@ export function LiveTrainAnnouncements({ const guessViaCrs = guessViaPoint(via.trim().toLowerCase(), train.subsequentLocations) addLog(`Guessed via ${guessViaCrs} for ${via}`) - console.log(`[Live Trains] Guessed via ${guessViaCrs} for ${via}`) + console.log(`[Live Trains] Guessed via ${guessViaCrs} for ${via.trim()}`) if (guessViaCrs && systems[systemKey].STATIONS.includes(guessViaCrs)) { const point = train.subsequentLocations.find(p => p.crs === guessViaCrs)