I am scraping the DOM of a static site with PHP and pulling out specific bit\'s of data so I can put stuff into a database.
For this example I am storing the inner H
Solution is to use a regex like this
function clean($string) {
$string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
return preg_replace('/[^A-Za-z0-9\-\;\,\?\*\%\@\$\!\(\)\#\=\&]/', '', $string); // Removes special chars
}
Adapt it to the special char you need or not add the one you want to keep catching like this \#
or esle \=