Zum Inhalt springen

Modul:URLutil: Unterschied zwischen den Versionen

disallow leading zero in ipV4, except when it's _just_ 0.
w>קיפודנחש
(moved comment about "only dotted decimal ipv4" to module header.)
w>קיפודנחש
(disallow leading zero in ipV4, except when it's _just_ 0.)
Zeile 30: Zeile 30:


function _isIpV4( s )
function _isIpV4( s )
     local function legal( n ) return ( tonumber( n ) or 256 ) < 256  end-- in lua 0 is true!
     local function legal( n ) return ( tonumber( n ) or 256 ) < 256  and not n:match("^0%d") end-- in lua 0 is true!
      
      
     if type( s ) ~= "string" then return false end
     if type( s ) ~= "string" then return false end
Anonymer Benutzer