I want to replace a middle string by passing the pattern. I have tried it by using pre_replace function. But it is not working for me.
$str = "Lead for Nebhub - Admark
Name: Punam Kalbande
Email: kalbandepunam@gmail.com
Phone Number: 800-703-3209
Nebhub Partner : Nebhub - Admark
Address: PO Box 830395 Miami, FL 33173
Hub : Automotive
Products: ERP, CRM, HCM, Help Desk, Marketing";
$pattern = '/^Hub :(.+)Products:$/i';
$replacement = "Logistics";
$result = preg_replace($pattern, $replacement, $str);
but the above code is only returning original string. It is not replacing with the new one.