From df73c2a2112bb1001ad2d7353ca9e5f7763942b1 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Thu, 4 May 2023 20:16:29 +0300 Subject: [PATCH] - add new discord validation --- includes/core/class-validation.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/core/class-validation.php b/includes/core/class-validation.php index 20de2b0e..9a5c54b2 100644 --- a/includes/core/class-validation.php +++ b/includes/core/class-validation.php @@ -306,10 +306,10 @@ if ( ! class_exists( 'um\core\Validation' ) ) { if ( ! $string ) { return true; } - if ( substr_count( $string, '#' ) > 1 ) { + if ( strlen( $string ) < 2 || strlen( $string ) > 31 ) { return false; } - if ( ! preg_match( '/^(.+)#(\d+)$/', trim( $string ) ) ) { + if ( ! preg_match( '/^[a-z\d_]+(?:\.[a-z\d_]+)*(\.[a-z]*)?$/', trim( $string ) ) ) { return false; } return true;