Home > PHP > Function > POSIX Regex > ereg()

ereg()

ereg - Regular expression match

Syntax

int ereg (string $pattern, string $string, array &$regs)

Arguments

  • pattern - Case sensitive regular expression.
  • string - The input string.
  • regs - If matches are found for parenthesized substrings of pattern and the function is called with the third argument regs, the matches will be stored in the elements of the array regs. will contain the substring which starts at the first left parenthesis; will contain the substring starting at the second, and so on. will contain a copy of the complete string matched.

Description

Searches a string for matches to the regular expression given in pattern in a case-sensitive way.

Version

PHP 4, 5

Return value

Returns the length of the matched string if a match for pattern was found in string, or FALSE if no matches were found or an error occurred.