From 4511275020b366e62a6bfb1eda1db772ad5bf658 Mon Sep 17 00:00:00 2001 From: gabriel0316 <81679576+gabriel0316@users.noreply.github.com> Date: Wed, 10 Apr 2024 10:44:35 +0200 Subject: [PATCH] Update semver regex --- .../src/main/java/org/hl7/fhir/utilities/VersionUtilities.java | 2 +- .../test/java/org/hl7/fhir/utilities/VersionUtilitiesTest.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java index 7091cdf16..6a2d3c504 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java @@ -328,7 +328,7 @@ public class VersionUtilities { if (Utilities.noString(version)) { return false; } - return version.matches("^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-\\+]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-\\+][0-9a-zA-Z-\\+]*))*))?$"); + return version.matches("^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"); } /** diff --git a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/VersionUtilitiesTest.java b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/VersionUtilitiesTest.java index ff2898b04..8a32c2276 100644 --- a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/VersionUtilitiesTest.java +++ b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/VersionUtilitiesTest.java @@ -12,6 +12,7 @@ public class VersionUtilitiesTest { assertTrue(VersionUtilities.isSemVer("0.1.1")); assertTrue(VersionUtilities.isSemVer("0.1.1-ballot1")); assertTrue(VersionUtilities.isSemVer("0.0.0-alpha.0.131")); + assertTrue(VersionUtilities.isSemVer("1.0.0+20130313144700")); assertFalse(VersionUtilities.isSemVer("0.1.a")); }