Php Find And Replace Regex Javascript Function Definition Is Not Allowed