Update Tools.php

Use preg_match instead of str_replace (deprecated)