summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Mazoyer <respawneral@gmail.com>2014-05-30 00:45:37 +0200
committerGuillaume Mazoyer <respawneral@gmail.com>2014-05-30 00:45:37 +0200
commit0d8a305d61aacaa0ee94374d3a26b531be28a09c (patch)
tree944352e116024c05024635c51fb34a845c5e9602
parentac14313e199cb01191768306bc5c14ac101f5814 (diff)
Update regex for matching FQDN.
-rw-r--r--utils.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils.php b/utils.php
index 6baafb8..e622642 100644
--- a/utils.php
+++ b/utils.php
@@ -28,7 +28,7 @@ function match_ipv6($ip) {
}
function match_fqdn($fqdn) {
- $regex = '/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/';
+ $regex = '/(?=^.{4,255}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)/';
if ((preg_match($regex, $fqdn) === false) ||
(preg_match($regex, $fqdn) === 0)) {