<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/reference.pcre.pattern.syntax.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'regexp.reference.meta.php',
    1 => 'Meta-characters',
    2 => 'Meta-characters',
  ),
  'up' => 
  array (
    0 => 'reference.pcre.pattern.syntax.php',
    1 => 'PCRE regex syntax',
  ),
  'prev' => 
  array (
    0 => 'regexp.reference.delimiters.php',
    1 => 'Delimiters',
  ),
  'next' => 
  array (
    0 => 'regexp.reference.escape.php',
    1 => 'Escape sequences',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/pcre/pattern.syntax.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="regexp.reference.meta" class="section">
  <h2 class="title">Meta-characters</h2>
  <p class="para">
   The power of regular expressions comes from the
   ability to include alternatives and repetitions in the
   pattern. These are encoded in the pattern by the use of
   <em>meta-characters</em>, which do not stand for themselves but instead
   are interpreted in some special way.
  </p>
  <p class="para">
   There are two different sets of meta-characters: those that
   are recognized anywhere in the pattern except within square
   brackets, and those that are recognized in square brackets.
   Outside square brackets, the meta-characters are as follows:

   <table class="doctable table">
     <caption><strong>Meta-characters outside square brackets</strong></caption>
    
     <thead>
      <tr>
       <th>Meta-character</th><th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>\</td><td>general escape character with several uses</td>
      </tr>

      <tr>
       <td>^</td><td>assert start of subject (or line, in multiline mode)</td>
      </tr>

      <tr>
       <td>$</td><td>assert end of subject or before a terminating newline (or
        end of line, in multiline mode)</td>
      </tr>

      <tr>
       <td>.</td><td>match any character except newline (by default)</td>
      </tr>

      <tr>
       <td>[</td><td>start character class definition</td>
      </tr>

      <tr>
       <td>]</td><td>end character class definition</td>
      </tr>

      <tr>
       <td>|</td><td>start of alternative branch</td>
      </tr>

      <tr>
       <td>(</td><td>start subpattern</td>
      </tr>

      <tr>
       <td>)</td><td>end subpattern</td>
      </tr>

      <tr>
       <td>?</td><td>extends the meaning of (, also 0 or 1 quantifier, also makes greedy
        quantifiers lazy (see <a href="regexp.reference.repetition.php" class="link">repetition</a>)</td>
      </tr>

      <tr>
       <td>*</td><td>0 or more quantifier</td>
      </tr>

      <tr>
       <td>+</td><td>1 or more quantifier</td>
      </tr>

      <tr>
       <td>{</td><td>start min/max quantifier</td>
      </tr>

      <tr>
       <td>}</td><td>end min/max quantifier</td>
      </tr>

     </tbody>
    
   </table>


   Part of a pattern that is in square brackets is called a
   <a href="regexp.reference.character-classes.php" class="link">character class</a>. In a character class the only
   meta-characters are:

   <table class="doctable table">
     <caption><strong>Meta-characters inside square brackets (<em>character classes</em>)</strong></caption>
    
     <thead>
      <tr>
       <th>Meta-character</th><th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>\</td><td>general escape character</td>
      </tr>

      <tr>
       <td>^</td><td>negate the class, but only if the first character</td>
      </tr>

      <tr>
       <td>-</td><td>indicates character range</td>
      </tr>

     </tbody>
    
   </table>


   The following sections describe the use of each of the
   meta-characters.
  </p>
 </div><?php manual_footer($setup); ?>