Sophie

Sophie

distrib > Mandriva > 2008.1 > i586 > by-pkgid > 703d980c580707c382b4e43e25965bc5 > files > 10934

php-manual-pt_BR-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Regular Expression Functions (Perl-Compatible)</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="Manual do PHP"
HREF="index.html"><LINK
REL="UP"
TITLE="Referência das Funções"
HREF="funcref.html"><LINK
REL="PREVIOUS"
TITLE="pcntl_wtermsig"
HREF="function.pcntl-wtermsig.html"><LINK
REL="NEXT"
TITLE="Pattern Modifiers"
HREF="reference.pcre.pattern.modifiers.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="reference"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Manual do PHP</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.pcntl-wtermsig.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="reference.pcre.pattern.modifiers.html"
ACCESSKEY="N"
>Próxima</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="reference"
><A
NAME="ref.pcre"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="title"
>CXX. Regular Expression Functions (Perl-Compatible)</H1
><DIV
CLASS="PARTINTRO"
><A
NAME="AEN165645"
></A
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="pcre.intro"
>Introdução</A
></H1
><P
>&#13;     The syntax for patterns used in these functions closely resembles
     Perl. The expression should be enclosed in the delimiters, a
     forward slash (/), for example.  Any character can be used for
     delimiter as long as it's not alphanumeric or backslash (\). If
     the delimiter character has to be used in the expression itself,
     it needs to be escaped by backslash. Since PHP 4.0.4, you can also use
     Perl-style (), {}, [], and &#60;&#62; matching delimiters.
     See <A
HREF="reference.pcre.pattern.syntax.html"
>Pattern Syntax</A
>
     for detailed explanation.
    </P
><P
>&#13;     The ending delimiter may be followed by various modifiers that
     affect the matching. 
     See <A
HREF="reference.pcre.pattern.modifiers.html"
>Pattern
      Modifiers</A
>.
    </P
><P
>&#13;     PHP also supports regular expressions using a POSIX-extended syntax
     using the <A
HREF="ref.regex.html"
>POSIX-extended regex functions</A
>.
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
      This extension maintains a global per-thread cache of compiled regular
      expressions (up to 4096).
     </P
></BLOCKQUOTE
></DIV
><DIV
CLASS="warning"
><P
></P
><TABLE
CLASS="warning"
BORDER="1"
WIDTH="100%"
><TR
><TD
ALIGN="CENTER"
><B
>Atenção</B
></TD
></TR
><TR
><TD
ALIGN="LEFT"
><P
>&#13;      You should be aware of some limitations of PCRE. Read <A
HREF="http://www.pcre.org/pcre.txt"
TARGET="_top"
>http://www.pcre.org/pcre.txt</A
> for more info.
     </P
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="pcre.requirements"
>Dependências</A
></H1
><P
>Nenhuma biblioteca externa é necessária para compilar esta extensão.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="pcre.installation"
>Instalação</A
></H1
><P
>&#13;  Beginning with PHP 4.2.0 these functions are enabled by default. You can
  disable the pcre functions with
  <CODE
CLASS="option"
>--without-pcre-regex</CODE
>. Use
  <CODE
CLASS="option"
> --with-pcre-regex=DIR</CODE
> to specify DIR
  where PCRE's include and library files are located, if not using bundled library.
  For older versions you have to configure and compile PHP 
  with <CODE
CLASS="option"
>--with-pcre-regex[=DIR]</CODE
> in order
  to use these functions.
 </P
><P
>A versão para Windows do <TT
CLASS="literal"
>PHP</TT
>
 tem suporte embutido para esta extensão. Você não precisa carregar nenhuma extensão
 adicional para utilizar essas funções.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="pcre.configuration"
>Configurações em execução</A
></H1
><P
>&#13;O comportamento dessas funções podem ser modificado pelas configurações do <TT
CLASS="filename"
>php.ini</TT
>.
</P
><P
>&#13;  <DIV
CLASS="table"
><A
NAME="AEN165675"
></A
><P
><B
>Tabela 1. PCRE Configuration Options</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><COL><COL><THEAD
><TR
><TH
>Name</TH
><TH
>Default</TH
><TH
>Changeable</TH
><TH
>Changelog</TH
></TR
></THEAD
><TBODY
><TR
><TD
>pcre.backtrack_limit</TD
><TD
>100000</TD
><TD
>PHP_INI_ALL</TD
><TD
>Available since PHP 5.2.0.</TD
></TR
><TR
><TD
>pcre.recursion_limit</TD
><TD
>100000</TD
><TD
>PHP_INI_ALL</TD
><TD
>Available since PHP 5.2.0.</TD
></TR
></TBODY
></TABLE
></DIV
>
  Para mais detalhes e definições das constantes
 PHP_INI_*, veja <A
HREF="ini.html"
>Apêndice H</A
>.
 </P
><P
>Breve descrição das
 diretivas de configuração.</P
><P
>&#13;  <P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><A
NAME="ini.pcre.backtrack-limit"
></A
><CODE
CLASS="parameter"
>pcre.backtrack_limit</CODE
>
     <A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
></DT
><DD
><P
>&#13;      PCRE's backtracking limit.
     </P
></DD
><DT
><A
NAME="ini.pcre.recursion-limit"
></A
><CODE
CLASS="parameter"
>pcre.recursion_limit</CODE
>
     <A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
></DT
><DD
><P
>&#13;      PCRE's recursion limit. Please note that if you set this value to a high
      number you may consume all the available process stack and eventually
      crash PHP (due to reaching the stack size limit imposed by the Operating
      System).
     </P
></DD
></DL
></DIV
>
 </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="pcre.resources"
>Tipos Resource</A
></H1
><P
>Esta extensão não possui nenhum tipo resource.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="pcre.constants"
>Constantes pré-definidas</A
></H1
><P
>&#13;As contantes abaixo são definidas por esta extensão e somente
 estarão disponíveis quando a extensão foi compilada com o PHP
 ou carregada dinamicamente durante a execução.
</P
><DIV
CLASS="table"
><A
NAME="AEN165717"
></A
><P
><B
>Tabela 2. PREG constants</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><THEAD
><TR
><TH
>constant</TH
><TH
>description</TH
></TR
></THEAD
><TBODY
><TR
><TD
>PREG_PATTERN_ORDER</TD
><TD
>&#13;      Orders results so that $matches[0] is an array of full pattern
      matches, $matches[1] is an array of strings matched by the first
      parenthesized subpattern, and so on. This flag is only used with
      <A
HREF="function.preg-match-all.html"
><B
CLASS="function"
>preg_match_all()</B
></A
>.
     </TD
></TR
><TR
><TD
>PREG_SET_ORDER</TD
><TD
>&#13;      Orders results so that $matches[0] is an array of first set of
      matches, $matches[1] is an array of second set of matches, and so
      on. This flag is only used with <A
HREF="function.preg-match-all.html"
><B
CLASS="function"
>preg_match_all()</B
></A
>.
     </TD
></TR
><TR
><TD
>PREG_OFFSET_CAPTURE</TD
><TD
>&#13;      See the description of
      <TT
CLASS="constant"
><B
>PREG_SPLIT_OFFSET_CAPTURE</B
></TT
>.  This flag is
      available since PHP 4.3.0.
     </TD
></TR
><TR
><TD
>PREG_SPLIT_NO_EMPTY</TD
><TD
>&#13;      This flag tells <A
HREF="function.preg-split.html"
><B
CLASS="function"
>preg_split()</B
></A
> to return only non-empty
      pieces.
     </TD
></TR
><TR
><TD
>PREG_SPLIT_DELIM_CAPTURE</TD
><TD
>&#13;      This flag tells <A
HREF="function.preg-split.html"
><B
CLASS="function"
>preg_split()</B
></A
> to capture
      parenthesized expression in the delimiter pattern as well. This flag
      is available since PHP 4.0.5.
     </TD
></TR
><TR
><TD
>PREG_SPLIT_OFFSET_CAPTURE</TD
><TD
>&#13;      If this flag is set, for every occurring match the appendant string
      offset will also be returned. Note that this changes the return
      values in an array where every element is an array consisting of the
      matched string at offset 0 and its string offset within subject at
      offset 1. This flag is available since PHP 4.3.0
      and is only used for <A
HREF="function.preg-split.html"
><B
CLASS="function"
>preg_split()</B
></A
>.
     </TD
></TR
><TR
><TD
>PREG_NO_ERROR</TD
><TD
>&#13;      Returned by <A
HREF="function.preg-last-error.html"
><B
CLASS="function"
>preg_last_error()</B
></A
> if there were no
      errors. Available since PHP 5.2.0.
     </TD
></TR
><TR
><TD
>PREG_INTERNAL_ERROR</TD
><TD
>&#13;      Returned by <A
HREF="function.preg-last-error.html"
><B
CLASS="function"
>preg_last_error()</B
></A
> if there was an
      internal PCRE error. Available since PHP 5.2.0.
     </TD
></TR
><TR
><TD
>PREG_BACKTRACK_LIMIT_ERROR</TD
><TD
>&#13;      Returned by <A
HREF="function.preg-last-error.html"
><B
CLASS="function"
>preg_last_error()</B
></A
> if <A
HREF="ref.pcre.html#ini.pcre.backtrack-limit"
>backtrack limit</A
> was exhausted.
      Available since PHP 5.2.0.
     </TD
></TR
><TR
><TD
>PREG_RECURSION_LIMIT_ERROR</TD
><TD
>&#13;      Returned by <A
HREF="function.preg-last-error.html"
><B
CLASS="function"
>preg_last_error()</B
></A
> if <A
HREF="ref.pcre.html#ini.pcre.recursion-limit"
>recursion limit</A
> was exhausted.
      Available since PHP 5.2.0.
     </TD
></TR
><TR
><TD
>PREG_BAD_UTF8_ERROR</TD
><TD
>&#13;      Returned by <A
HREF="function.preg-last-error.html"
><B
CLASS="function"
>preg_last_error()</B
></A
> if the last error was
      caused by malformed UTF-8 data (only when running a regex in <A
HREF="reference.pcre.pattern.modifiers.html"
>UTF-8 mode</A
>). Available
      since PHP 5.2.0.
     </TD
></TR
></TBODY
></TABLE
></DIV
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="pcre.examples"
>Exemplos</A
></H1
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN165775"
></A
><P
><B
>Exemplo 1. Examples of valid patterns</B
></P
><P
></P
><UL
><LI
><P
><TT
CLASS="literal"
>/&#60;\/\w+&#62;/</TT
></P
></LI
><LI
><P
><TT
CLASS="literal"
>|(\d{3})-\d+|Sm</TT
></P
></LI
><LI
><P
><TT
CLASS="literal"
>/^(?i)php[34]/</TT
></P
></LI
><LI
><P
><TT
CLASS="literal"
>{^\s+(\s+)?$}</TT
></P
></LI
></UL
></DIV
></TD
></TR
></TABLE
>
    </P
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN165791"
></A
><P
><B
>Exemplo 2. Examples of invalid patterns</B
></P
><P
></P
><UL
><LI
><P
>&#13;         <TT
CLASS="literal"
>/href='(.*)'</TT
> - missing ending delimiter
        </P
></LI
><LI
><P
>&#13;         <TT
CLASS="literal"
>/\w+\s*\w+/J</TT
> - unknown modifier 'J'
        </P
></LI
><LI
><P
>&#13;         <TT
CLASS="literal"
>1-\d3-\d3-\d4|</TT
> - missing starting delimiter
        </P
></LI
></UL
></DIV
></TD
></TR
></TABLE
>
    </P
></DIV
></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>Índice</B
></DT
><DT
><A
HREF="reference.pcre.pattern.modifiers.html"
>Pattern Modifiers</A
>&nbsp;--&nbsp;Describes possible modifiers in regex
   patterns</DT
><DT
><A
HREF="reference.pcre.pattern.syntax.html"
>Pattern Syntax</A
>&nbsp;--&nbsp;Describes PCRE regex syntax</DT
><DT
><A
HREF="function.preg-grep.html"
>preg_grep</A
>&nbsp;--&nbsp;Return array entries that match the pattern</DT
><DT
><A
HREF="function.preg-last-error.html"
>preg_last_error</A
>&nbsp;--&nbsp;Returns the error code of the last PCRE regex execution</DT
><DT
><A
HREF="function.preg-match-all.html"
>preg_match_all</A
>&nbsp;--&nbsp;Perform a global regular expression match</DT
><DT
><A
HREF="function.preg-match.html"
>preg_match</A
>&nbsp;--&nbsp;Perform a regular expression match</DT
><DT
><A
HREF="function.preg-quote.html"
>preg_quote</A
>&nbsp;--&nbsp;Quote regular expression characters</DT
><DT
><A
HREF="function.preg-replace-callback.html"
>preg_replace_callback</A
>&nbsp;--&nbsp;Perform a regular expression search and replace using a callback</DT
><DT
><A
HREF="function.preg-replace.html"
>preg_replace</A
>&nbsp;--&nbsp;Perform a regular expression search and replace</DT
><DT
><A
HREF="function.preg-split.html"
>preg_split</A
>&nbsp;--&nbsp;Split string by a regular expression</DT
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.pcntl-wtermsig.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Principal</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="reference.pcre.pattern.modifiers.html"
ACCESSKEY="N"
>Próxima</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>pcntl_wtermsig</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="funcref.html"
ACCESSKEY="U"
>Acima</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Pattern Modifiers</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>