JavaScript: preg_replace