mirror of
https://github.com/LdesignMedia/moodle-availability_ipaddress.git
synced 2026-05-17 05:48:41 +02:00
Update RegExp to not exceed 132 characters
This commit is contained in:
16
yui/src/form/js/form.js
vendored
16
yui/src/form/js/form.js
vendored
@@ -128,11 +128,19 @@ M.availability_ipaddress.validateIpaddress = function(ipaddresses) {
|
||||
Y.log('Correct ipv4');
|
||||
continue;
|
||||
}
|
||||
if (new RegExp(/^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}-([0-1]?[0-9]?[0-9]?|2[0-4][0-9]|25[0-5]){1}$/gm)
|
||||
.test(ipaddresses[i])) {
|
||||
Y.log('Correct ipv4 range.');
|
||||
continue;
|
||||
|
||||
var ipv4Regex = new RegExp(
|
||||
'^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)' +
|
||||
'(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}-' +
|
||||
'([0-1]?[0-9]?[0-9]?|2[0-4][0-9]|25[0-5]){1}$',
|
||||
'gm'
|
||||
);
|
||||
|
||||
if (ipv4Regex.test(ipaddresses[i])) {
|
||||
Y.log('Correct ipv4 range.');
|
||||
continue;
|
||||
}
|
||||
|
||||
if (new RegExp(M.availability_ipaddress.v6)
|
||||
.test(ipaddresses[i])) {
|
||||
Y.log('Correct ipv6');
|
||||
|
||||
Reference in New Issue
Block a user