With this code I can block special characters in my input
, however I want it to still accept .
, -
and _
how to proceed?
elseif (!preg_match('/^[a-z A-Z0-9]+$/', $username)) {
echo json_encode(array(
'login' => false,
'message' => 'Existem caracteres especiais no seu nome de usuário, se estiver utilizando <strong>@</strong>, remova-o.'
));
}