PHP mb_eregi_replace() Function Last Updated : 31 Mar, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report The mb_eregi_replace() is an inbuilt function in PHP that is used to perform the replacement of regular expression characters. It is a case-insensitive regular expression search and replace with multi-byte character support. Syntax: mb_eregi_replace( string $pattern, string $replacement, string $string, ?string $options = null ): string|false|nullParameters: This function accepts four parameters that are described below: $pattern: This parameter specifies the regular expression pattern to search for.$replacement: This parameter specifies the string that is to be replaced.$string: This is the string where we search and replace the string.$options: This is the optional parameter with some following flags: 'm' (multiline matching), 's' (single-line matching), 'r' (replace backreferences), and 'i' (case-insensitive matching).Return Value: This function returns the resultant string, in case of not getting an error, otherwise return false. Also, null will be returned in the case when the string is not valid for the current encoding. Example 1: The following program demonstrates the mb_eregi_replace() function. PHP <?php $string = "GFG"; $pattern = "[G]"; $replacement = "T"; $result = mb_eregi_replace($pattern, $replacement, $string); echo $result; ?> Output: TFT Example 2: The following program demonstrates the mb_eregi_replace() function. PHP <?php $string = "water work word"; $pattern = "[W]"; $replacement = "r"; $result = mb_eregi_replace($pattern,$replacement, $string); echo $result; ?> Output: water work word Reference: https://www.php.net/manual/en/function.mb-eregi-replace.php Comment More infoAdvertise with us Next Article PHP mb_eregi() Function N neeraj3304 Follow Improve Article Tags : PHP PHP-function PHP-Multibyte-String Similar Reads PHP mb_ereg_replace() Function The mb_ereg_replace() is an inbuilt function in PHP that is used to search & replace a string using the regular expression. This function is similar to the preg_match() but works on the multibyte string. Syntax: mb_ereg_replace( $pattern, $replacement, $string, $options = null): string|false|nul 1 min read PHP | ereg_replace() Function The ereg_replace() is an inbuilt function in PHP and is used to search a string pattern in an other string. If pattern is found in the original string then it will replace matching text with a replacement string. You may refer to the article on Regular Expression for basic understanding of pattern m 3 min read PHP mb_ereg_search() Function The mb_ereg_search() is a PHP function used to search & match for a regular expression pattern in a string using multi-byte characters. It is similar to preg_match() but works with multi-byte characters. Syntax: mb_ereg_search(?string $pattern = null, ?string $options = null): boolParameters: Th 2 min read PHP mb_ereg_replace_callback() Function The mb_ereg_replace_callback() function is an inbuilt function in PHP that is used to replace a regular expression match in a string using the callback function. Syntax: mb_ereg_replace_callback( $pattern, $callback,$string,$options): string|false|null Parameters: The function accepts four parameter 2 min read PHP mb_eregi() Function The mb_eregi() function is an inbuilt function in PHP that performs case-insensitive regular expression matches on a string having multibyte support. If the string pattern is matched, then it will return the string otherwise it will return false. Syntax: mb_eregi( string $pattern, string $string, ar 2 min read PHP mb_ereg() Function The mb_ereg() function is an inbuilt function in PHP that is used for searching a string in the multibyte string by using the regular expression. Syntax: mb_ereg($pattern, $string, $matches ): bool Parameters: The following function has three parameters that are described below. $pattern: The regula 1 min read Like