Update Resource.php

preg_replace function is now deprecated, this has been replaced with preg_replace_callback function.