Current Location: Home> Function Categories> mb_eregi

mb_eregi

Multi-byte supports regular expression matching and ignore case
Name:mb_eregi
Category:Multi-byte string
Programming Language:php
One-line Description:Perform case-insensitive regular expression matching

Function name: mb_eregi()

Applicable version: PHP 4 >= 4.2.0, PHP 5, PHP 7

Usage: The mb_eregi() function performs case-insensitive regular expression matching. Similar to the mb_ereg() function, but is case-insensitive.

Syntax: int mb_eregi(string $pattern, string $string [, array &$regs])

parameter:

  • $pattern: The regular expression pattern to match.
  • $string: The string in which to match.
  • $regs (optional): If this parameter is provided, an array is filled with matching substrings.

Return value: Return a non-zero integer if the match is successful, otherwise return 0.

Example:

 $str = "Hello, World!"; if (mb_eregi("hello", $str)) { echo "匹配成功!"; } else { echo "匹配失败!"; } // 输出:匹配成功!

In the above example, the mb_eregi() function uses the regular expression pattern "hello" to match in the string "$str". Since it is case-insensitive, the match is successful and the output is "Match Success!".

Similar Functions
Popular Articles