0

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 ?

user198989
  • 4,574
  • 19
  • 66
  • 95

1 Answers1

1

Use the /u modifier. That will enable Unicode for the regexes. http://php.net/manual/en/reference.pcre.pattern.modifiers.php