<?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 => 'pt_BR',
  ),
  'this' => 
  array (
    0 => 'regexp.reference.comments.php',
    1 => 'Coment&aacute;rios',
    2 => 'Coment&aacute;rios',
  ),
  'up' => 
  array (
    0 => 'reference.pcre.pattern.syntax.php',
    1 => 'Sintaxe das express&otilde;es regulares PCRE',
  ),
  'prev' => 
  array (
    0 => 'regexp.reference.conditional.php',
    1 => 'Sub-express&otilde;es condicionais',
  ),
  'next' => 
  array (
    0 => 'regexp.reference.recursive.php',
    1 => 'Express&otilde;es recursivas',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'pt_BR',
    '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.comments" class="section">
  <h2 class="title">Comentários</h2>
  <p class="para">
   A sequência (?# marca o início de um comentário que
   continua até o próximo parêntese de fechamento. Parênteses
   aninhados não são permitidos. Os caracteres que compõem um
   comentário não desempenham nenhum papel na correspondência de expressões.
  </p>
  <p class="para">
   Se a opção <a href="reference.pcre.pattern.modifiers.php" class="link">PCRE_EXTENDED</a>
   estiver definida, um caractere # sem escape fora de uma classe de caracteres
   introduz um comentário que continua até o próximo caractere de nova linha
   na expressão.
  </p>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemplo #1 Uso de comentários em expressões PCRE</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$subject </span><span style="color: #007700">= </span><span style="color: #DD0000">'test'</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">/* (?# pode ser usado para adicionar comentários sem habilitar PCRE_EXTENDED */<br /></span><span style="color: #0000BB">$match </span><span style="color: #007700">= </span><span style="color: #0000BB">preg_match</span><span style="color: #007700">(</span><span style="color: #DD0000">'/te(?# isto é um comentário)st/'</span><span style="color: #007700">, </span><span style="color: #0000BB">$subject</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$match</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Espaço em branco e # são tratados como parte da expressão a menos que PCRE_EXTENDED esteja habilitada */<br /></span><span style="color: #0000BB">$match </span><span style="color: #007700">= </span><span style="color: #0000BB">preg_match</span><span style="color: #007700">(</span><span style="color: #DD0000">'/te   #~~~~<br />st/'</span><span style="color: #007700">, </span><span style="color: #0000BB">$subject</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$match</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Quando PCRE_EXTENDED está habilitada, todos os espaços em branco e qualquer coisa que<br />   esteja na sequência de um # sem escape na mesma linha são ignorados */<br /></span><span style="color: #0000BB">$match </span><span style="color: #007700">= </span><span style="color: #0000BB">preg_match</span><span style="color: #007700">(</span><span style="color: #DD0000">'/te    #~~~~<br />st/x'</span><span style="color: #007700">, </span><span style="color: #0000BB">$subject</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$match</span><span style="color: #007700">);</span></span></code></div>
    </div>

    <div class="example-contents"><p>O exemplo acima produzirá:</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive cdata"><pre>
int(1)
int(0)
int(1)
</pre></div>
    </div>
   </div>
  </p>
 </div><?php manual_footer($setup); ?>