Allow only [a-z][A-Z][0-9] in string using PHP

You can filter it like:

$text = preg_replace("/[^a-zA-Z0-9]+/", "", $text);

As for some symbols, you should be more specific

Leave a Comment