Woops! I thought you were just discarding everything after the last dot.
@thebadbad - nice to see there's another way of doing things, probably closer to 'best practice'
Anyhow, here's how my code changes now that I understand what you needed to happen.
<?php
$pos = strrpos($str, '.'); // this will give us the position of the last dot in the string -- strpos() will give you the first occurrence
$newstring = substr($str, 0, $pos) . preg_replace("/[^a-zA-Z0-9]/", "", substr($str, $pos));
// You'll have $newstring, which contains everything up to the last dot and all alphanumeric characters after the last dot in the string
?>