PHP mb_eregi() Function Last Updated : 03 Oct, 2023 Comments Improve Suggest changes Like Article Like Report 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, array &$matches = null): boolParameters: The following function has three parameters that are described below. $pattern: The regular expression pattern that we used for matching against the multibyte string.$string: This is the string where we search our pattern.$matches: This is the parameter that stores the matched substrings which starts from the left parentheses from the $string input. $matches[1] will have the matched substring which starts at the first left parentheses and $matches[2] will have the matched substring which starts at the second left parentheses and so on.Return Values: The mb_eregi() function returns a boolean value after executing the case insensitive regular expression. If the function found the pattern in the given string, it will return "true", otherwise it will return "false". Program 1: The following program demonstrates the mb_eregi() function. PHP <?php $string = "Hello, World!"; $pattern = "world"; // Set the multibyte encoding mb_regex_encoding("UTF-8"); if (mb_eregi($pattern, $string)) { echo "Pattern found!"; } else { echo "Pattern not found."; } ?> OutputPattern found!Program 2: The following program demonstrates the mb_eregi() function. PHP <?php $subject = "VDwS0ErZ5K"; if (mb_eregi("^[A-Za-z\s]+$", $subject)) { echo "Match found!"; } else { echo "Match not found!"; } ?> OutputMatch not found! Reference: https://www.php.net/manual/en/function.mb-eregi.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() 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 PHP ereg() Function The Ereg() function in PHP searches a string to match the regular expression given in the pattern. The function is case-sensitive. This function has been deprecated in PHP 5.3.0 and removed in PHP 7.0.0. Syntax: int ereg ( string $pattern , string $str, array &$arr ); Parameters: pattern: It is 2 min read PHP mb_ereg_match() Function The mb_ereg_match() is an inbuilt function in PHP that is used for matching multibyte strings using regular expressions. Syntax: mb_ereg_match(pattern, string, options = null): boolParameters: This function has 3 parameters: pattern: The pattern parameters define the regular expressionstring: This p 1 min read PHP mb_eregi_replace() Function 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 $str 2 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 Like