<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/refs.basic.text.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'book.pcre.php',
    1 => 'PCRE',
    2 => 'Regular Expressions (Perl-Compatible)',
  ),
  'up' => 
  array (
    0 => 'refs.basic.text.php',
    1 => 'Text Processing',
  ),
  'prev' => 
  array (
    0 => 'class.parle-parserexception.php',
    1 => 'Parle\\ParserException',
  ),
  'next' => 
  array (
    0 => 'pcre.setup.php',
    1 => 'Installing/Configuring',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/pcre/book.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/book.pcre.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="book.pcre" class="book">
 
 <h1 class="title">Regular Expressions (Perl-Compatible)</h1>
    

 <div id="intro.pcre" class="preface">
  <h1 class="title">Introduction</h1>
  <p class="para">
   The syntax for patterns used in these functions closely resembles
   Perl. The expression must be enclosed in the delimiters, a
   forward slash (/), for example.  Delimiters can be any 
   non-alphanumeric, non-whitespace ASCII character except the backslash (\) and the
   null byte. If the delimiter character has to be used in the 
   expression itself, it needs to be escaped by backslash.
   Perl-style (), {}, [], and &lt;&gt; matching delimiters may also be used.
   See <a href="reference.pcre.pattern.syntax.php" class="link">Pattern Syntax</a>
   for detailed explanation.
  </p>
  <p class="para">
   The ending delimiter may be followed by various modifiers that
   affect the matching. 
   See <a href="reference.pcre.pattern.modifiers.php" class="link">Pattern
    Modifiers</a>.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    This extension maintains a global per-thread cache of compiled regular
    expressions (up to 4096).
   </p>
  </p></blockquote>
  <div class="warning"><strong class="warning">Warning</strong>
   <p class="para">
    You should be aware of some limitations of PCRE. Read <a href="http://www.pcre.org/pcre.txt" class="link external">&raquo;&nbsp;http://www.pcre.org/pcre.txt</a> for more info.
   </p>
  </div>
  
  <p class="para">
   The PCRE library is a set of functions that implement regular
   expression pattern matching using the same syntax and semantics
   as Perl 5, with just a few differences (see below).  The current
   implementation corresponds to Perl 5.005.
  </p>
 </div>

 






 




 






 







 








<ul class="chunklist chunklist_book"><li><a href="pcre.setup.php">Installing/Configuring</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="pcre.installation.php">Installation</a></li><li><a href="pcre.configuration.php">Runtime Configuration</a></li></ul></li><li><a href="pcre.constants.php">Predefined Constants</a></li><li><a href="pcre.examples.php">Examples</a></li><li><a href="pcre.pattern.php">PCRE Patterns</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="reference.pcre.pattern.syntax.php">PCRE regex syntax</a> — Pattern Syntax</li><li><a href="reference.pcre.pattern.modifiers.php">Possible modifiers in regex patterns</a> — Pattern Modifiers</li><li><a href="reference.pcre.pattern.differences.php">Differences From Perl</a> — Perl Differences</li></ul></li><li><a href="ref.pcre.php">PCRE Functions</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="function.preg-filter.php">preg_filter</a> — Perform a regular expression search and replace</li><li><a href="function.preg-grep.php">preg_grep</a> — Return array entries that match the pattern</li><li><a href="function.preg-last-error.php">preg_last_error</a> — Returns the error code of the last PCRE regex execution</li><li><a href="function.preg-last-error-msg.php">preg_last_error_msg</a> — Returns the error message of the last PCRE regex execution</li><li><a href="function.preg-match.php">preg_match</a> — Perform a regular expression match</li><li><a href="function.preg-match-all.php">preg_match_all</a> — Perform a global regular expression match</li><li><a href="function.preg-quote.php">preg_quote</a> — Quote regular expression characters</li><li><a href="function.preg-replace.php">preg_replace</a> — Perform a regular expression search and replace</li><li><a href="function.preg-replace-callback.php">preg_replace_callback</a> — Perform a regular expression search and replace using a callback</li><li><a href="function.preg-replace-callback-array.php">preg_replace_callback_array</a> — Perform a regular expression search and replace using callbacks</li><li><a href="function.preg-split.php">preg_split</a> — Split string by a regular expression</li></ul></li></ul></div><?php manual_footer($setup); ?>