Skip to content

Commit acaa37f

Browse files
authored
Merge pull request #283 from MultiDirectoryLab/feature/MD-1424
MD-1424
2 parents 4398c2e + b79a755 commit acaa37f

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

projects/multidirectory-app/src/app/core/validators/ip-universal.directive.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ import { translate } from '@jsverse/transloco';
1515
})
1616
export class UniversalIpValidatorDirective implements Validator {
1717
readonly errorLabel = input(translate('error-message.ip-valid'));
18-
ipPattern = new RegExp(
19-
'^(?:(?: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]?)(?:-(?:(?: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]?))?(?:\\/(?:[0-9]|[1-2][0-9]|3[0-2]))?$',
20-
);
18+
ipPattern = /^(?:(?: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]?)(?:-(?:(?: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]?))?(?:\/(?:[0-9]|[1-2][0-9]|3[0-2]))?(?:,\s*(?:(?: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]?)(?:-(?:(?: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]?))?(?:\/(?:[0-9]|[1-2][0-9]|3[0-2]))?)*$/;
2119

2220
validate(control: AbstractControl): ValidationErrors | null {
2321
return this.ipPattern.test(control.value) ? null : { IpAddress: this.errorLabel() };

0 commit comments

Comments
 (0)