How can regular expressions be used to clean up a string by replacing non-alphanumeric characters with spaces?

Regular expressions can be used to clean up a string by replacing non-alphanumeric characters with spaces. This can be achieved by using the `preg_replace` function in PHP, which allows you to search for specific patterns in a string and replace them with a specified value. By using a regular expression pattern that matches all non-alphanumeric characters (i.e., characters that are not letters or numbers), you can easily replace them with spaces to clean up the string.

$string = "This is a string with !@#$%^&*() non-alphanumeric characters 12345";
$cleaned_string = preg_replace('/[^a-zA-Z0-9]+/', ' ', $string);
echo $cleaned_string;