<?php $mydata = 'this is @ test & Strings'; $mydata = preg_replace("/[^a-zA-Z0-9s]/", "", $mydata); //print $mydata; will output "thisistestStrings"?>