From 50aed91921f7aa4556df2f3a6da5993661fb68f6 Mon Sep 17 00:00:00 2001 From: Fabian Steeg Date: Thu, 25 Apr 2024 14:58:06 +0200 Subject: [PATCH] Also consider 3-digit years (RPB-157) --- app/models/AuthorityResource.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/AuthorityResource.java b/app/models/AuthorityResource.java index 362e64e..504bfa0 100644 --- a/app/models/AuthorityResource.java +++ b/app/models/AuthorityResource.java @@ -562,6 +562,7 @@ private static String year(JsonNode node) { return ""; } String text = node.elements().next().asText(); - return text.replaceAll(".*(\\d{4}).*", "$1"); + return text.matches(".*\\d{4}.*") ? text.replaceAll(".*(\\d{4}).*", "$1") + : text.replaceAll(".*(\\d{3}).*", "$1"); } }