Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Quote string with slashes in a C style
<?php addcslashes(string $string, string $characters): string
<?php         $prefixEscaped = preg_quote($prefix);




        $foundWithPrefix = addcslashes($prefix.$found, '$\\');



        $pattern = "/(?<!{$prefixEscaped}){$foundEscaped}(?![^<]*(?<![?=-])>)/mUi";
<?php         $suffixEscaped = preg_quote($suffix);




        $foundWithSuffix = addcslashes($found.$suffix, '$\\');



        $pattern = "/{$foundEscaped}(?!\w)(?!{$suffixEscaped})(?![^<]*(?<![?=-])>)/mUi";