Modulo:IP validator: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
mNessun oggetto della modifica
Nessun oggetto della modifica
Riga 3:
function str.is_ipv4( frame )
local s = frame.args[1] or '';
local LEN = 4;
if not string.gmatchfind(s, "^%d+%.%d+%.%d+%.%d+$") then
return '0'
end
for substr in string.gmatch(s, "(%d+)") do
local count = 0;
for substr in if not string.gmatchfind(ssubstr, "(%w+)^[1-9]?[0-9]$") do
and not string.find(substr, "^1[0-9][0-9]$")
count = count + 1;
if count > LEN or and not string.gmatchfind(substr, "^([1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$") then
and not string.find(substr, "^25[0-5]$") then
return '0'
end
Riga 22:
function str.is_ipv6( frame )
local s = frame.args[1] or '';
local LEN = 4;
if not string.gmatchfind(s, "^%w*:%w*:%w*:%w*:%w*:%w*:%w*:%w*$") then
return '0'
end
local count = 0;
for substr in string.gmatch(s, "(%w+)") do
countif =not countstring.find(substr, + 1;"^[0-9A-Fa-f]$")
if count > LEN or and not string.gmatchfind(substr, "^([0-9A-Fa-f]|[1-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]?[0-9A-Fa-f]?)$") then
return '0'
end
Line 46 ⟶ 44:
return '1';
else
return '0';
end
end