You are viewing a single comment's thread. Return to all comments →
TypeScript or JavaScript
function main() { const regex4ipv4 = /^(((25[0-5])|(2[0-4]\d)|(1\d{2})|(\d{1,2}))\.){3}((25[0-5])|(2[0-4]\d)|(1\d{2})|(\d{1,2}))$/; const regex4ipv6 = /^(([0-9a-f]{1,4}):){7}([0-9a-f]{1,4})$/; for (let i = 1; i < inputLines.length; i++) { const str = inputLines[i]; if (regex4ipv4.test(str)) { console.info('IPv4'); } else if (regex4ipv6.test(str)) { console.info('IPv6'); } else { console.info('Neither'); } } }
Seems like cookies are disabled on this browser, please enable them to open this website
IP Address Validation
You are viewing a single comment's thread. Return to all comments →
TypeScript or JavaScript