I only want to allow letters and numbers. However, I want to add some certain foreign letters, too. I tried
$nick = "Çağsan";
$nick = preg_replace("/[^a-zA-Z0-9ğĞüÜİışŞçÇÖö]+/", "", $nick);
But it used a-zA-Z0-9 rule only. What is the correct way to do that ?
Use the /u modifier. That will enable Unicode for the regexes. http://php.net/manual/en/reference.pcre.pattern.modifiers.php