JSFiddle - React, Tailwind, and code Playground

by Kishore Sahasranaman

JavaScript

function IPPattern() {
    for (i = 0; i < document.getElementByClass("IPForm").length; i++) {
        document.getElementByClass("IPForm")[i].pattern = "^(?!(10\.|169\.254\.|192\.168\.|172\.(1[6-9]|2\d|30|31)\.))^(([1-9]|[1-9]\d|1\d{2}|2[0-1]\d|22[0-3])\.((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){2}([1-9]|[1-9]\d|1\d{2}|2[0-4]\d|25[0-4]))$";
    };
}