View source for Module:IPAddress

Jump to navigation Jump to search

You do not have permission to edit this page, for the following reason:

You do not have permission to edit pages in the Module namespace.


You can view and copy the source of this page.

local p = {}
function p._isIpV6(s)
local dcolon, groups
if type(s) ~= "string"
or s:len() == 0
or s:find("[^:%x]") -- only colon and hex digits are legal chars
or s:find("^:[^:]") -- can begin or end with :: but not with single :
or s:find("[^:]:$")
or s:find(":::")
then
return false
end
s, dcolon = s:gsub("::", ":")
if dcolon > 1 then return false end -- at most one ::
s = s:gsub("^:?", ":") -- prepend : if needed, upper
s, groups = s:gsub(":%x%x?%x?%x?", "") -- remove valid groups, and count them
return ( (dcolon == 1 and groups < 8) or (dcolon == 0 and groups == 8) )
and ( s:len() == 0 or (dcolon == 1 and s == ":") ) -- might be one dangling : if original ended with ::
end
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
000
1:0
Debug console
* The module exports are available as the variable "p", including unsaved modifications. * Precede a line with "=" to evaluate it as an expression or use print(). Use mw.logObject() for tables. * Use mw.log() and mw.logObject() in module code to send messages to this console.

Return to Module:IPAddress.