mirror of https://github.com/rancher/dashboard.git
10 lines
357 B
JavaScript
10 lines
357 B
JavaScript
const validCIDRregex = /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/(3[0-2]|2[0-9]|1[0-9]|[0-9])$/;
|
|
|
|
export function isValidCIDR(cidr) {
|
|
return !!cidr.match(validCIDRregex);
|
|
}
|
|
|
|
export function isValidMac(value) {
|
|
return /^[A-Fa-f0-9]{2}(-[A-Fa-f0-9]{2}){5}$|^[A-Fa-f0-9]{2}(:[A-Fa-f0-9]{2}){5}$/.test(value);
|
|
}
|