Visit the Official PHP Website

Search this Site

PHP Programming

By James N Hitz

What are Regular Expressions?

As already said a regular expression is a pattern of characters used for searching and processing text - actually that is why it is also called pattern matching. A pattern to be matched has to be eclosed between two fore-slashes:

/pattern-to-match/;

Regular expressions are manipulate string data and can also be used to manipulate data stored in variables. In order to do this, PHP makes use of the following funntions:

  1. preg_match() to TEST for EQUALITY and INEQUALITY
  2. preg_replace() to REPLACE one string of data with another
  3. preg_split() to CONVERT a string into a list array

As is usual, we'll discuss each... a little later. First let's take stock.

This is what we have said so far:

  1. a regular expression is enclosed in two fore-slashes:
    /regular expression/
  2. a regular expressions makes use of the following functions:
    1. preg_match()
    2. preg_replace()
    3. preg_split()

Question is: How?

<< Very Little Coding | Create Regular Expressions (RegExp) >>

JamHitz Productions