mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-10 17:59:53 +03:00
initial commit
This commit is contained in:
6
interface/src/validators/isHostname.ts
Normal file
6
interface/src/validators/isHostname.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
const hostnameLengthRegex = /^.{0,32}$/
|
||||
const hostnamePatternRegex = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$/
|
||||
|
||||
export default function isHostname(hostname: string) {
|
||||
return hostnameLengthRegex.test(hostname) && hostnamePatternRegex.test(hostname);
|
||||
}
|
||||
Reference in New Issue
Block a user