Update ajax.php

NEW / Use preg_match instead of str_replace (deprecated)