Function name: mb_ereg_search_getregs()
Applicable version: PHP 4 >= 4.2.0, PHP 5, PHP 7
Function description: The mb_ereg_search_getregs() function returns the matching result array of the most recent multibyte regular expression search.
Usage: The usage of the mb_ereg_search_getregs() function is as follows:
mb_ereg_search_getregs(): array|false
This function has no parameters.
Return value:
Example:
$str = "Hello World!"; mb_regex_encoding("UTF-8"); mb_ereg_search_init($str, "l+"); if (mb_ereg_search()) { $regs = mb_ereg_search_getregs(); print_r($regs); }
Output:
Array ( [0] => ll )
In the example above, we first set the string encoding to UTF-8, then initialize the regular expression search using the mb_ereg_search_init() function, and then search using the mb_ereg_search() function. If a match is found, we use the mb_ereg_search_getregs() function to get the matching result array and print the result using the print_r() function.
Note: Before using the mb_ereg series function, you must call the mb_regex_encoding() function to set the character encoding.