diff --git a/src/Mbstring/Mbstring.php b/src/Mbstring/Mbstring.php index 10adfc347..86ee1ed5a 100644 --- a/src/Mbstring/Mbstring.php +++ b/src/Mbstring/Mbstring.php @@ -1017,7 +1017,7 @@ private static function mb_internal_trim(string $regex, string $string, ?string } $regexCharacter = preg_quote($characters ?? '', '/'); - $regex = sprintf('/'.$regex.'/', $regexCharacter, $regexCharacter); + $regex = sprintf($regex, $regexCharacter, $regexCharacter); if ('ASCII' === mb_detect_encoding($characters) && 'ASCII' === mb_detect_encoding($string) && !empty(array_intersect(str_split(self::CHARACTERS), str_split($string)))) { $options = 'g';