diff --git a/lib/resolv.rb b/lib/resolv.rb index b69c7045ca..61c9c7d5cf 100644 --- a/lib/resolv.rb +++ b/lib/resolv.rb @@ -2464,7 +2464,7 @@ class Resolv Regex_8HexLinkLocal = /\A [Ff][Ee]80 (?::[0-9A-Fa-f]{1,4}){7} - %[0-9A-Za-z]+ + %[-0-9A-Za-z._~]+ \z/x ## @@ -2478,7 +2478,7 @@ class Resolv | :((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?) )? - :[0-9A-Fa-f]{1,4}%[0-9A-Za-z.]+ + :[0-9A-Fa-f]{1,4}%[-0-9A-Za-z._~]+ \z/x ## diff --git a/test/resolv/test_addr.rb b/test/resolv/test_addr.rb index 62092676ba..f701c31d3e 100644 --- a/test/resolv/test_addr.rb +++ b/test/resolv/test_addr.rb @@ -28,6 +28,10 @@ class TestResolvAddr < Test::Unit::TestCase assert_match(Resolv::IPv6::Regex, "FE80:2:3:4:5:6:7:8%EM1", bug17112) assert_match(Resolv::IPv6::Regex, "FE80::20D:3AFF:FE7D:9760%ETH0", bug17112) assert_match(Resolv::IPv6::Regex, "FE80::1%EM1", bug17112) + + bug17524 = "[ruby-core:101992]" + assert_match(Resolv::IPv6::Regex, "FE80::20D:3AFF:FE7D:9760%ruby_3.0.0-1", bug17524) + assert_match(Resolv::IPv6::Regex, "fe80::1%ruby_3.0.0-1", bug17524) end def test_valid_socket_ip_address_list