Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 11017

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Internal option setting</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="regexp.reference.alternation.html">Alternation</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="regexp.reference.subpatterns.html">Subpatterns</a></div>
 <div class="up"><a href="reference.pcre.pattern.syntax.html">PCRE regex syntax</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="regexp.reference.internal-options" class="section">
  <h2 class="title">Internal option setting</h2>
  <p class="para">
   The settings of <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_CASELESS</a>, 
   <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_MULTILINE</a>,  
   <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_DOTALL</a>,
   <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_UNGREEDY</a>,
   <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_EXTRA</a>,
   <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_EXTENDED</a>
   and PCRE_DUPNAMES can be changed from within the pattern by
   a sequence of Perl option letters enclosed between &quot;(?&quot;  and
   &quot;)&quot;. The option letters are:
   
   <table class="doctable table">
    <caption><strong>Internal option letters</strong></caption>
    
     <tbody class="tbody">
      <tr>
       <td><em>i</em></td>
       <td>for <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_CASELESS</a></td>
      </tr>

      <tr>
       <td><em>m</em></td>
       <td>for <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_MULTILINE</a></td>
      </tr>

      <tr>
       <td><em>s</em></td>
       <td>for <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_DOTALL</a></td>
      </tr>

      <tr>
       <td><em>x</em></td>
       <td>for <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_EXTENDED</a></td>
      </tr>

      <tr>
       <td><em>U</em></td>
       <td>for <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_UNGREEDY</a></td>
      </tr>

      <tr>
       <td><em>X</em></td>
       <td>for <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_EXTRA</a></td>
      </tr>

      <tr>
       <td><em>J</em></td>
       <td>for <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_INFO_JCHANGED</a></td>
      </tr>

     </tbody>
    
   </table>

  </p>
  <p class="para">
   For example, (?im) sets case-insensitive (caseless), multiline matching. It  is
   also possible to unset these options by preceding the letter
   with a hyphen, and a combined setting and unsetting such  as
   (?im-sx),  which sets <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_CASELESS</a> and
   <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_MULTILINE</a>
   while unsetting <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_DOTALL</a> and
   <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_EXTENDED</a>,
   is also  permitted. If  a  letter  appears both before and after the
   hyphen, the option is unset.
  </p>
  <p class="para">
   When an option change occurs at top level (that is, not inside
   subpattern parentheses), the change applies to the remainder of the
   pattern that follows. So <em>/ab(?i)c/</em> matches only &quot;abc&quot;
   and &quot;abC&quot;.
  </p>
  <p class="para">
   If an option change occurs inside a subpattern,  the  effect
   is  different.  This is a change of behaviour in Perl 5.005.
   An option change inside a subpattern affects only that  part
   of the subpattern that follows it, so
   
   <em>(a(?i)b)c</em>
   
   matches  abc  and  aBc  and  no  other   strings   (assuming <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_CASELESS</a> is not
   used). By this means, options can be made to have different settings in
   different parts of the pattern. Any changes made in one alternative do
   carry on into subsequent branches within the same subpattern. For
   example,
   
   <em>(a(?i)b|c)</em>
   
   matches &quot;ab&quot;, &quot;aB&quot;, &quot;c&quot;, and &quot;C&quot;, even though when  matching
   &quot;C&quot; the first branch is abandoned before the option setting.
   This is because the effects of  option  settings  happen  at
   compile  time. There would be some very weird behaviour otherwise.
  </p>
  <p class="para">
   The PCRE-specific options <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_UNGREEDY</a>  and  
   <a href="reference.pcre.pattern.modifiers.html" class="link">PCRE_EXTRA</a>   can
   be changed in the same way as the Perl-compatible options by
   using the characters U and X  respectively.  The  (?X)  flag
   setting  is  special in that it must always occur earlier in
   the pattern than any of the additional features it turns on,
   even when it is at top level. It is best put at the start.
  </p>
 </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="regexp.reference.alternation.html">Alternation</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="regexp.reference.subpatterns.html">Subpatterns</a></div>
 <div class="up"><a href="reference.pcre.pattern.syntax.html">PCRE regex syntax</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>