replace dns validation regex

Signed-off-by: pitwegner <pit.wegner@student.hpi.de>
This commit is contained in:
pitwegner
2023-03-09 12:28:37 +01:00
parent 082111cf2e
commit 586e7f08bb
2 changed files with 2 additions and 1 deletions
@@ -155,6 +155,7 @@ describe('CommonValidatorFunctions', () => {
['-a-b', false],
['a-b-', false],
['a--b', false],
['xn--c6h', true],
['a_b', false],
[`${'a'.repeat(63)}`, true],
[`${'a'.repeat(64)}`, false],
@@ -91,7 +91,7 @@ export class CommonValidatorFunctions {
typeof value === 'string' &&
value.length >= 1 &&
value.length <= 63 &&
/^[a-z0-9]+(\-[a-z0-9]+)*$/.test(value)
/^((?!\-))(xn\-\-)?[a-z0-9\-]+[a-z0-9]$/.test(value)
);
}