diff --git a/interface/lib/classes/validate_cron.inc.php b/interface/lib/classes/validate_cron.inc.php
index 9a2af803663f84f1b93734890b1da9edf2ee1cb2..888fdd5cb718c2d084aa6db8a49b2851cd03aedd 100644
--- a/interface/lib/classes/validate_cron.inc.php
+++ b/interface/lib/classes/validate_cron.inc.php
@@ -52,7 +52,7 @@ class validate_cron {
 
 			if($parsed["scheme"] != "http" && $parsed["scheme"] != "https") return $this->get_error($validator['errmsg']);
 
-			if(preg_match("'^([a-z0-9][a-z0-9_\-]{0,62}\.)+([A-Za-z0-9\-]{2,30})$'i", $parsed["host"]) == false) return $this->get_error($validator['errmsg']);
+			if(preg_match("'^([a-z0-9][a-z0-9_\-]{0,62}\.)+([A-Za-z0-9\-]{2,63})$'i", $parsed["host"]) == false) return $this->get_error($validator['errmsg']);
 		}
 		if(strpos($field_value, "\n") !== false || strpos($field_value, "\r") !== false || strpos($field_value, chr(0)) !== false) {
 			return $this->get_error($validator['errmsg']);
diff --git a/interface/lib/classes/validate_domain.inc.php b/interface/lib/classes/validate_domain.inc.php
index 57187805cf926289f450b31088cf3540b36a7fb8..d8c87e09f1d6f8b41cf6a0be6e6bf66058515f79 100644
--- a/interface/lib/classes/validate_domain.inc.php
+++ b/interface/lib/classes/validate_domain.inc.php
@@ -51,7 +51,7 @@ class validate_domain {
 
 		$result = $this->_check_unique($field_value);
 		if(!$result) return $this->get_error('domain_error_unique');
-		
+
 		$pattern = '/\.acme\.invalid$/';
 		if(preg_match($pattern, $field_value)) return $this->get_error('domain_error_acme_invalid');
 	}
@@ -68,7 +68,7 @@ class validate_domain {
 
 		$result = $this->_check_unique($field_value);
 		if(!$result) return $this->get_error('domain_error_unique');
-		
+
 		$pattern = '/\.acme\.invalid$/';
 		if(preg_match($pattern, $field_value)) return $this->get_error('domain_error_acme_invalid');
 	}
@@ -83,7 +83,7 @@ class validate_domain {
 
 		$result = $this->_check_unique($field_value);
 		if(!$result) return $this->get_error('domain_error_unique');
-		
+
 		$pattern = '/\.acme\.invalid$/';
 		if(preg_match($pattern, $field_value)) return $this->get_error('domain_error_acme_invalid');
 	}
@@ -98,7 +98,7 @@ class validate_domain {
 		} else {
 			$check_domain = $_POST['domain'];
 		}
-		
+
 		$app->uses('ini_parser,getconf');
 		$settings = $app->getconf->get_global_config('domains');
 		if ($settings['use_domain_module'] == 'y') {
@@ -111,26 +111,26 @@ class validate_domain {
 		$result = $this->_check_unique($field_value . '.' . $check_domain, true);
 		if(!$result) return $this->get_error('domain_error_autosub');
 	}
-	
+
 	/* Check apache directives */
 	function web_apache_directives($field_name, $field_value, $validator) {
 		global $app;
-		
+
 		if(trim($field_value) != '') {
 			$security_config = $app->getconf->get_security_config('ids');
-		
+
 			if($security_config['apache_directives_scan_enabled'] == 'yes') {
-				
+
 				// Get blacklist
 				$blacklist_path = '/usr/local/ispconfig/security/apache_directives.blacklist';
 				if(is_file('/usr/local/ispconfig/security/apache_directives.blacklist.custom')) $blacklist_path = '/usr/local/ispconfig/security/apache_directives.blacklist.custom';
 				if(!is_file($blacklist_path)) $blacklist_path = realpath(ISPC_ROOT_PATH.'/../security/apache_directives.blacklist');
-				
+
 				$directives = explode("\n",$field_value);
 				$regex = explode("\n",file_get_contents($blacklist_path));
 				$blocked = false;
 				$blocked_line = '';
-				
+
 				if(is_array($directives) && is_array($regex)) {
 					foreach($directives as $directive) {
 						$directive = trim($directive);
@@ -144,31 +144,31 @@ class validate_domain {
 				}
 			}
 		}
-		
+
 		if($blocked === true) {
 			return $this->get_error('apache_directive_blocked_error').' '.$blocked_line;
 		}
 	}
-	
+
 	/* Check nginx directives */
 	function web_nginx_directives($field_name, $field_value, $validator) {
 		global $app;
-		
+
 		if(trim($field_value) != '') {
 			$security_config = $app->getconf->get_security_config('ids');
-		
+
 			if($security_config['nginx_directives_scan_enabled'] == 'yes') {
-				
+
 				// Get blacklist
 				$blacklist_path = '/usr/local/ispconfig/security/nginx_directives.blacklist';
 				if(is_file('/usr/local/ispconfig/security/nginx_directives.blacklist.custom')) $blacklist_path = '/usr/local/ispconfig/security/nginx_directives.blacklist.custom';
 				if(!is_file($blacklist_path)) $blacklist_path = realpath(ISPC_ROOT_PATH.'/../security/nginx_directives.blacklist');
-				
+
 				$directives = explode("\n",$field_value);
 				$regex = explode("\n",file_get_contents($blacklist_path));
 				$blocked = false;
 				$blocked_line = '';
-				
+
 				if(is_array($directives) && is_array($regex)) {
 					foreach($directives as $directive) {
 						$directive = trim($directive);
@@ -182,16 +182,16 @@ class validate_domain {
 				}
 			}
 		}
-		
+
 		if($blocked === true) {
 			return $this->get_error('nginx_directive_blocked_error').' '.$blocked_line;
 		}
 	}
-	
+
 
 	/* internal validator function to match regexp */
 	function _regex_validate($domain_name, $allow_wildcard = false) {
-		$pattern = '/^' . ($allow_wildcard == true ? '(\*\.)?' : '') . '[\w\.\-]{1,255}\.[a-zA-Z0-9\-]{2,30}$/';
+		$pattern = '/^' . ($allow_wildcard == true ? '(\*\.)?' : '') . '[\w\.\-]{1,255}\.[a-zA-Z0-9\-]{2,63}$/';
 		return preg_match($pattern, $domain_name);
 	}
 
@@ -229,8 +229,8 @@ class validate_domain {
 				$domain_params[] = $aliassubdomain['domain'];
 			}
 		}
-		
-		
+
+
 		$qrystr = "SELECT d.domain_id, IF(d.parent_domain_id != 0 AND p.domain_id IS NOT NULL, p.ip_address, d.ip_address) as `ip_address`, IF(d.parent_domain_id != 0 AND p.domain_id IS NOT NULL, p.ipv6_address, d.ipv6_address) as `ipv6_address` FROM `web_domain` as d LEFT JOIN `web_domain` as p ON (p.domain_id = d.parent_domain_id) WHERE (d.domain = ?" . $additional_sql1 . ") AND d.server_id = ? AND d.domain_id != ?" . ($primary_id ? " AND d.parent_domain_id != ?" : "");
 		$params = array_merge(array($domain_name), $domain_params, array($domain['server_id'], $primary_id, $primary_id));
 		$checks = $app->db->queryAllRecords($qrystr, true, $params);
@@ -242,7 +242,7 @@ class validate_domain {
 				if($domain['ipv6_address'] != '' && $check['ipv6_address'] == $domain['ipv6_address']) return false;
 			}
 		}
-		
+
 		if($only_domain == false) {
 			$qrystr = "SELECT d.domain_id, IF(d.parent_domain_id != 0 AND p.domain_id IS NOT NULL, p.ip_address, d.ip_address) as `ip_address`, IF(d.parent_domain_id != 0 AND p.domain_id IS NOT NULL, p.ipv6_address, d.ipv6_address) as `ipv6_address` FROM `web_domain` as d LEFT JOIN `web_domain` as p ON (p.domain_id = d.parent_domain_id) WHERE (CONCAT(d.subdomain, '.', d.domain) = ?" . $additional_sql2 . ") AND d.server_id = ? AND d.domain_id != ?" . ($primary_id ? " AND d.parent_domain_id != ?" : "");
 			$params = array_merge(array($domain_name), $domain_params, array($domain['server_id'], $primary_id, $primary_id));
@@ -256,7 +256,7 @@ class validate_domain {
 				}
 			}
 		}
-		
+
 		return true;
 	}
 
@@ -274,6 +274,6 @@ class validate_domain {
 		}
 		return true; // admin may always add wildcard domain
 	}
-	
+
 
 }
diff --git a/interface/web/admin/form/server_config.tform.php b/interface/web/admin/form/server_config.tform.php
index f64ce30926ec80539d59e5a71f202f3befb076a2..0d570f2e947c2009d6c36141b3e739ff592d5f9a 100644
--- a/interface/web/admin/form/server_config.tform.php
+++ b/interface/web/admin/form/server_config.tform.php
@@ -131,7 +131,7 @@ $form["tabs"]['server'] = array(
 			'validators' => array(	0 => array('type' => 'NOTEMPTY',
 												'errmsg' => 'hostname_error_empty'),
 									1 => array ('type' => 'REGEX',
-												'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/',
+												'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,63}$/',
 												'errmsg'=> 'hostname_error_regex'),
 			),
 			'value' => '',
diff --git a/interface/web/client/form/domain.tform.php b/interface/web/client/form/domain.tform.php
index 2d3e1dbdd1781145ea9d06140333879c5fdd1ac6..a3dc1aaac030bab9328c8beb677d32033c86dea1 100644
--- a/interface/web/client/form/domain.tform.php
+++ b/interface/web/client/form/domain.tform.php
@@ -100,7 +100,7 @@ $form["tabs"]['domain'] = array (
 				1 => array ( 'type' => 'UNIQUE',
 					'errmsg'=> 'domain_error_unique'),
 				2 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/',
+					'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,63}$/',
 					'errmsg'=> 'domain_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/dns/dns_wizard.php b/interface/web/dns/dns_wizard.php
index a02ee0a80fb750d273f580c7c6b5388cd706e147..91b2307dc5126dc3650a1f3a38a754ea135151e9 100644
--- a/interface/web/dns/dns_wizard.php
+++ b/interface/web/dns/dns_wizard.php
@@ -220,10 +220,10 @@ if ($domains_settings['use_domain_module'] == 'y') {
 }
 
 if($_POST['create'] == 1) {
-	
+
 	//* CSRF Check
 	$app->auth->csrf_token_check();
-	
+
 	$error = '';
 
 	if ($post_server_id)
@@ -277,17 +277,17 @@ if($_POST['create'] == 1) {
 
 
 	if(isset($_POST['domain']) && $_POST['domain'] == '') $error .= $app->lng('error_domain_empty').'<br />';
-	elseif(isset($_POST['domain']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9\-]{2,30}$/', $_POST['domain'])) $error .= $app->lng('error_domain_regex').'<br />';
+	elseif(isset($_POST['domain']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9\-]{2,63}$/', $_POST['domain'])) $error .= $app->lng('error_domain_regex').'<br />';
 
 	if(isset($_POST['ip']) && $_POST['ip'] == '') $error .= $app->lng('error_ip_empty').'<br />';
 
 	if(isset($_POST['ipv6']) && $_POST['ipv6'] == '') $error .= $app->lng('error_ipv6_empty').'<br />';
 
 	if(isset($_POST['ns1']) && $_POST['ns1'] == '') $error .= $app->lng('error_ns1_empty').'<br />';
-	elseif(isset($_POST['ns1']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,30}$/', $_POST['ns1'])) $error .= $app->lng('error_ns1_regex').'<br />';
+	elseif(isset($_POST['ns1']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,63}$/', $_POST['ns1'])) $error .= $app->lng('error_ns1_regex').'<br />';
 
 	if(isset($_POST['ns2']) && $_POST['ns2'] == '') $error .= $app->lng('error_ns2_empty').'<br />';
-	elseif(isset($_POST['ns2']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,30}$/', $_POST['ns2'])) $error .= $app->lng('error_ns2_regex').'<br />';
+	elseif(isset($_POST['ns2']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,63}$/', $_POST['ns2'])) $error .= $app->lng('error_ns2_regex').'<br />';
 
 	if(isset($_POST['email']) && $_POST['email'] == '') $error .= $app->lng('error_email_empty').'<br />';
 	elseif(isset($_POST['email']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) $error .= $app->lng('error_email_regex').'<br />';
@@ -324,7 +324,7 @@ if($_POST['create'] == 1) {
 	if($_POST['ns2'] != '') $tpl_content = str_replace('{NS2}', $_POST['ns2'], $tpl_content);
 	if($_POST['email'] != '') $tpl_content = str_replace('{EMAIL}', $_POST['email'], $tpl_content);
 	$enable_dnssec = (($_POST['dnssec'] == 'Y') ? 'Y' : 'N');
-	if(isset($_POST['dkim']) && preg_match('/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,30}[\.]{0,1}$/', $_POST['domain'])) {
+	if(isset($_POST['dkim']) && preg_match('/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,63}[\.]{0,1}$/', $_POST['domain'])) {
 		$sql = $app->db->queryOneRecord("SELECT dkim_public, dkim_selector FROM mail_domain WHERE domain = ? AND dkim = 'y' AND ".$app->tform->getAuthSQL('r'), $_POST['domain']);
 		$public_key = $sql['dkim_public'];
 		if ($public_key!='') {
diff --git a/interface/web/dns/form/dns_slave.tform.php b/interface/web/dns/form/dns_slave.tform.php
index 0b4457b700a2f385f0c98782d38c7023daa14f24..55e085861a128c37e24c87a3dc94a75a476e70a2 100644
--- a/interface/web/dns/form/dns_slave.tform.php
+++ b/interface/web/dns/form/dns_slave.tform.php
@@ -96,7 +96,7 @@ $form["tabs"]['dns_slave'] = array (
 														'errmsg'=> 'origin_error_unique'),
 										*/
 				1 => array ( 'type' => 'REGEX',
-					'regex' => '/^[a-zA-Z0-9\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,30}[\.]{0,1}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,63}[\.]{0,1}$/',
 					'errmsg'=> 'origin_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/dns/form/dns_soa.tform.php b/interface/web/dns/form/dns_soa.tform.php
index e56211782a4e4190e5faa347429c33f37787e758..cf0d143916c5fe2679777d1756ec96089bac9105 100644
--- a/interface/web/dns/form/dns_soa.tform.php
+++ b/interface/web/dns/form/dns_soa.tform.php
@@ -95,7 +95,7 @@ $form["tabs"]['dns_soa'] = array (
 				1 => array ( 'type' => 'UNIQUE',
 					'errmsg'=> 'origin_error_unique'),
 				2 => array ( 'type' => 'REGEX',
-					'regex' => '/^[a-zA-Z0-9\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,30}[\.]{0,1}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,63}[\.]{0,1}$/',
 					'errmsg'=> 'origin_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/mail/ajax_get_json.php b/interface/web/mail/ajax_get_json.php
index 412958a31500cacaa5cebf5d61a7c133a2973519..dfc9dc220c0b9ea5ff7d5c4c0c5ed90f666449fe 100644
--- a/interface/web/mail/ajax_get_json.php
+++ b/interface/web/mail/ajax_get_json.php
@@ -52,7 +52,7 @@ if($type == 'create_dkim' && $domain_id != ''){
 	$mail_config = $app->getconf->get_server_config($server_id, 'mail');
 	$dkim_strength = $app->functions->intval($mail_config['dkim_strength']);
 	if ($dkim_strength=='') $dkim_strength = 2048;
-	
+
 	$rnd_val = $dkim_strength * 10;
 	$app->system->exec_safe('openssl rand -out ../../temp/random-data.bin '.$rnd_val.' 2> /dev/null');
 	$app->system->exec_safe('openssl genrsa -rand ../../temp/random-data.bin '.$dkim_strength.' 2> /dev/null');
@@ -113,7 +113,7 @@ header('Content-type: application/json');
 echo $json;
 
 function validate_domain($domain) {
-	$regex = '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/';
+	$regex = '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,63}$/';
 	if ( preg_match($regex, $domain) === 1 ) return true; else return false;
 }
 
diff --git a/interface/web/mail/form/mail_domain_catchall.tform.php b/interface/web/mail/form/mail_domain_catchall.tform.php
index 34d26088cd78ecdacd1093231b756752a26098a2..72261e05e0f7d496dc7581f7683ad027fa42c5d7 100644
--- a/interface/web/mail/form/mail_domain_catchall.tform.php
+++ b/interface/web/mail/form/mail_domain_catchall.tform.php
@@ -86,7 +86,7 @@ $form["tabs"]['catchall'] = array (
 				1 => array ( 'type' => 'UNIQUE',
 					'errmsg'=> 'domain_error_unique'),
 				2 => array ( 'type' => 'REGEX',
-					'regex' => '/^\@[\w\.\-]{2,255}\.[a-zA-Z\-]{2,30}$/',
+					'regex' => '/^\@[\w\.\-]{2,255}\.[a-zA-Z\-]{2,63}$/',
 					'errmsg'=> 'domain_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/mail/form/mail_user.tform.php b/interface/web/mail/form/mail_user.tform.php
index 83142f8a854d26e2a57753d43defde1d4703a2a6..3d1a8fde7fa5b0afe5a56ffdb2a38c456d3849e6 100644
--- a/interface/web/mail/form/mail_user.tform.php
+++ b/interface/web/mail/form/mail_user.tform.php
@@ -181,7 +181,7 @@ $form["tabs"]['mailuser'] = array(
 					'type' => 'TOLOWER')
 			),
 			'validators' => array (  0 => array ( 'type' => 'REGEX',
-					'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}(,\s*\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,}$/i',
+					'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,63}){0,1}(,\s*\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,63}){0,}$/i',
 					'errmsg'=> 'cc_error_isemail'),
 			),
 			'default' => '',
@@ -200,7 +200,7 @@ $form["tabs"]['mailuser'] = array(
 					'type' => 'TOLOWER')
 			),
 			'validators' => array (  0 => array ( 'type' => 'REGEX',
-					'regex'=>'/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}(,\s*\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,}$/i',
+					'regex'=>'/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,63}){0,1}(,\s*\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,63}){0,}$/i',
 					'errmsg'=> 'sender_cc_error_isemail'),
 			),
 			'default' => '',
@@ -360,7 +360,7 @@ if ($global_config['mail']['mailbox_show_autoresponder_tab'] === 'y') {
 			'autoresponder_start_date' => array (
 				'datatype' => 'DATETIME',
 				'formtype' => 'DATETIME',
-				'validators'=> array ( 
+				'validators'=> array (
 					0 => array ( 'type' => 'ISDATETIME',
 						'allowempty' => 'y',
 						'errmsg'=> 'autoresponder_start_date_is_no_date'),
@@ -373,7 +373,7 @@ if ($global_config['mail']['mailbox_show_autoresponder_tab'] === 'y') {
 			'autoresponder_end_date' => array (
 				'datatype' => 'DATETIME',
 				'formtype' => 'DATETIME',
-				'validators'=> array (  
+				'validators'=> array (
 					0 => array ( 'type' => 'ISDATETIME',
 						'allowempty' => 'y',
 						'errmsg'=> 'autoresponder_end_date_is_no_date'),
diff --git a/interface/web/mail/form/xmpp_domain.tform.php b/interface/web/mail/form/xmpp_domain.tform.php
index bbe694f9fd389fe24d741fb02c739e3a1b40362d..c703b0bea39b43c60df6234488dc994262a1b5d6 100644
--- a/interface/web/mail/form/xmpp_domain.tform.php
+++ b/interface/web/mail/form/xmpp_domain.tform.php
@@ -103,7 +103,7 @@ $form["tabs"]['domain'] = array (
 				1 => array ( 'type' => 'UNIQUE',
 					'errmsg'=> 'domain_error_unique'),
 				2 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/',
+					'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,63}$/',
 					'errmsg'=> 'domain_error_regex'),
 			),
 			'default' => '',