Update semver regex
This commit is contained in:
parent
1f3d2838d9
commit
4511275020
|
@ -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-]+)*))?$");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue