вот моя регулярка те на 1088 знаков работает как часы, разобраться не пытайся, она генерированная
/^(([\da-f]{1,4}:){7}([\da-f]{1,4}|(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d\d|2[0-4]\d|25[0-5]))|::(([\da-f]{1,4}:){0,6}([\da-f]{1,4}|(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d\d|2[0-4]\d|25[0-5]))?)?|([\da-f]{1,4}:){0,6}([\da-f]{1,4}|(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d\d|2[0-4]\d|25[0-5]))?::|([\da-f]{1,4}:):([\da-f]{1,4}:){0,5}([\da-f]{1,4}|(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d\d|2[0-4]\d|25[0-5]))|([\da-f]{1,4}:){1,2}:([\da-f]{1,4}:){0,4}([\da-f]{1,4}|(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d\d|2[0-4]\d|25[0-5]))|([\da-f]{1,4}:){1,3}:([\da-f]{1,4}:){0,3}([\da-f]{1,4}|(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d\d|2[0-4]\d|25[0-5]))|([\da-f]{1,4}:){1,4}:([\da-f]{1,4}:){0,2}([\da-f]{1,4}|(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d\d|2[0-4]\d|25[0-5]))|([\da-f]{1,4}:){1,5}:([\da-f]{1,4}:)?([\da-f]{1,4}|(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d\d|2[0-4]\d|25[0-5]))|([\da-f]{1,4}:){1,6}:([\da-f]{1,4}|(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])))$/i