diff --git a/main/src/io/github/iltotore/iron/constraint/string.scala b/main/src/io/github/iltotore/iron/constraint/string.scala index 6b6481aa..a8d36433 100644 --- a/main/src/io/github/iltotore/iron/constraint/string.scala +++ b/main/src/io/github/iltotore/iron/constraint/string.scala @@ -72,7 +72,7 @@ object string: */ type ValidURL = Match[ - "((\\w+:)+\\/\\/)?(([-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6})|(localhost))(:\\d{1,5})?(\\/|\\/([-a-zA-Z0-9@:%_\\+.~#?&//=]*))?" + "((\\w+:)+\\/\\/)?(([-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,63})|(localhost))(:\\d{1,5})?(\\/|\\/([-a-zA-Z0-9@:%_\\+.~#?&//=]*))?" ] DescribedAs "Should be an URL" /** diff --git a/main/test/src/io/github/iltotore/iron/testing/StringSuite.scala b/main/test/src/io/github/iltotore/iron/testing/StringSuite.scala index f12993ba..2f847996 100644 --- a/main/test/src/io/github/iltotore/iron/testing/StringSuite.scala +++ b/main/test/src/io/github/iltotore/iron/testing/StringSuite.scala @@ -64,6 +64,7 @@ object StringSuite extends TestSuite: test - "http://example.com/#section".assertRefine[ValidURL] test - "http://example.com/?q=with%20space".assertRefine[ValidURL] test - "http://example.com/?q=with+space".assertRefine[ValidURL] + test - "https://aaaaa-bbb-cccccc-dddddddd.eeeeeeee-fff.ggg.hhhhhhhhh:1234".assertRefine[ValidURL] test - "/example.com".assertNotRefine[ValidURL] test - "://example.com".assertNotRefine[ValidURL] test - "http:///".assertNotRefine[ValidURL]