If you mean to prevent any numeric characters, use ^[a-z]+$
^[a-zA-Z]+$
^[a-zA-Z ]+$
^[a-zA-Z0-9]+$
^[a-zA-Z0-9 ]+$
^[a-zA-Z0-9 _]+$
^[a-zA-Z0-9 _\-]+$
I think the OP was looking to allow letters and numbers, but disallow if ONLY numbers.
^[a-zA-Z0-9]*[a-zA-Z][a-zA-Z0-9]*$
^[a-zA-Z0-9 ]*[a-zA-Z][a-zA-Z0-9 ]*$
^[a-zA-Z0-9]*[a-zA-Z][a-zA-Z0-9]*$
Hi i use PHP 7.10 and mariadatabase i try all codes above but none of them not works any help?
Got big problems with users who use caps lock in nick names.
$matchRegex = $this->getOption(self::OPTION_USERNAME_REGEX);
if ($matchRegex)
{
$matchRegex = str_replace('#', '\\#', $matchRegex); // escape delim only
if (!preg_match('#' . $matchRegex . '#i', $username))
{
$this->error(new XenForo_Phrase('please_enter_another_name_required_format'), 'username');
return false;
}
}
// fix extra whitespace and invisible ascii stuff
$username = trim(preg_replace('#\s+#si', '', strip_blank_ascii($username, ' ')));
//// lower
$username = strtolower($username);
// Umlauts
$array_1 = array("ä","ö","ü","ß");
$array_2 = array("ae","oe","ue","ss");
for($x=0;$x<4;$x++) {
$username = str_replace($array_1[$x],$array_2[$x],$username);
}
// Only one!
$username = str_replace("--","",$username);
$username = str_replace("..","",$username);
$username = str_replace("__","",$username);
$username = str_replace("._","",$username);
$username = str_replace(".-","",$username);
$username = str_replace("-_","",$username);
$username = str_replace("-.","",$username);
$username = str_replace("_-","",$username);
$username = str_replace("_.","",$username);
// Ucase first
$username = ucfirst($username);
We use essential cookies to make this site work, and optional cookies to enhance your experience.