- add new discord validation

This commit is contained in:
ashubawork
2023-05-04 20:16:29 +03:00
parent 596c2673fd
commit df73c2a211
+2 -2
View File
@@ -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;