diff --git a/src/lib/classes/engine/Validation.ts b/src/lib/classes/engine/Validation.ts index 0117c8c..75e1ede 100644 --- a/src/lib/classes/engine/Validation.ts +++ b/src/lib/classes/engine/Validation.ts @@ -3,8 +3,12 @@ export function validateName(name: string | undefined): boolean { return false; } +const regexTest: RegExp = new RegExp( + "^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$", // Will test for any valid IP address +); + export function validateIP(ipAdress: string): boolean { - return URL.canParse(ipAdress); + return URL.canParse(ipAdress) || regexTest.test(ipAdress); } export function validateStartPort(port: number): boolean {