[wd_asp elements=’search’ ratio=’100%’ id=1]

Replace all but 0-9 and a-z and spaces

12th March 2014

Php - Strings

php codehaven

This can’t be used for a normal character replace, only REGEX code is allowed!
Try PHP String Replace for an alternative

Nice Regex to replace characters not allowed into database

$newtag = preg_replace("/[^0-9a-zA-Z -]/", "", $newtag);

//another version which may be depreciated (notice this lets in @ signs)
$value= ereg_replace("[^A-Za-z0-9@]", "", $value);