#native_company# #native_desc#
#native_cta#

PHP and Regular Expressions 101 Page 2

By Mitchell Harper
on May 31, 2007

PHP has six functions that work with regular expressions. They all take a regular expression string
as their first argument, and are shown below:
  • ereg: The most common regular expression function, ereg allows us
    to search a string for matches of a regular expression.
  • ereg_replace: Allows us to search a string for a regular expression and replace
    any occurrence of that expression with a new string.
  • eregi: Performs exactly the same matching as ereg, but is case
    insensitive.
  • eregi_replace: Performs exactly the same search-replace functionality as
    ereg_replace, but is case insensitive.
  • split: Allows us to search a string for a regular expression and returns the
    matches as an array of strings.
  • spliti: Case insensitive version of the split function
This article originally appeared on WebReference.com.