From ac4faf1af2c58ad32d8ec35ff58e6813206001b4 Mon Sep 17 00:00:00 2001 From: steveoh Date: Mon, 12 Aug 2024 16:11:50 -0600 Subject: [PATCH] fix(api): strip state out of zone refs #371 --- src/api/Cache/RegexCache.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api/Cache/RegexCache.cs b/src/api/Cache/RegexCache.cs index b9202926..59c0ebdc 100644 --- a/src/api/Cache/RegexCache.cs +++ b/src/api/Cache/RegexCache.cs @@ -36,6 +36,8 @@ public RegexCache(IAbbreviations abbreviations) { "cityTownCruft", cityTownCruft() }, { "stripCitySuffix", stripCitySuffix() + }, { + "stripStateSuffix", stripStateSuffix() }, { "avesOrdinal", BuildOrdinalRegex() } @@ -142,6 +144,8 @@ private static string ToOrdinal(int number) { private static partial Regex cityName(); [GeneratedRegex("(?:city|town)(?: of)", RegexOptions.IgnoreCase | RegexOptions.Compiled, "en-US")] private static partial Regex cityTownCruft(); - [GeneratedRegex("(?:cty|city)$", RegexOptions.IgnoreCase | RegexOptions.Compiled, "en-US")] + [GeneratedRegex("\\b(?:cty|city)$", RegexOptions.IgnoreCase | RegexOptions.Compiled, "en-US")] private static partial Regex stripCitySuffix(); + [GeneratedRegex("\\b(?:utah|ut)$", RegexOptions.IgnoreCase | RegexOptions.Compiled, "en-US")] + private static partial Regex stripStateSuffix(); }