<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.mbstring.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.mb-regex-set-options.php',
    1 => 'mb_regex_set_options',
    2 => 'Set/Get the default options for mbregex functions',
  ),
  'up' => 
  array (
    0 => 'ref.mbstring.php',
    1 => 'Multibyte String Functions',
  ),
  'prev' => 
  array (
    0 => 'function.mb-regex-encoding.php',
    1 => 'mb_regex_encoding',
  ),
  'next' => 
  array (
    0 => 'function.mb-rtrim.php',
    1 => 'mb_rtrim',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mbstring/functions/mb-regex-set-options.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.mb-regex-set-options" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_regex_set_options</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">mb_regex_set_options</span> &mdash; <span class="dc-title">Set/Get the default options for mbregex functions</span></p>

 </div>
   
 <div class="refsect1 description" id="refsect1-function.mb-regex-set-options-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mb_regex_set_options</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$options</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="simpara">
   Sets the default options described by <code class="parameter">options</code> 
   for multibyte regex functions.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mb-regex-set-options-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">options</code></dt>
     <dd>
      <p class="para">
       The options to set. This is a string where each 
       character is an option. To set a mode, the mode 
       character must be the last one set, however there 
       can only be set one mode but multiple options.
      </p>

      <table class="doctable table">
       <caption><strong>Regex options</strong></caption>
       
        <thead>
         <tr>
          <th>Option</th>
          <th>Meaning</th>
          <th>Changelog</th>
         </tr>

        </thead>

        <tbody class="tbody">
         <tr>
          <td>i</td>
          <td>Ambiguity match on</td>
          <td class="empty">&nbsp;</td>
         </tr>

         <tr>
          <td>x</td>
          <td>Enables extended pattern form</td>
          <td class="empty">&nbsp;</td>
         </tr>

         <tr>
          <td>m</td>
          <td><code class="literal">&#039;.&#039;</code> matches with newlines</td>
          <td class="empty">&nbsp;</td>
         </tr>

         <tr>
          <td>s</td>
          <td><code class="literal">&#039;^&#039;</code> -&gt; <code class="literal">&#039;\A&#039;</code>, <code class="literal">&#039;$&#039;</code> -&gt; <code class="literal">&#039;\Z&#039;</code></td>
          <td class="empty">&nbsp;</td>
         </tr>

         <tr>
          <td>p</td>
          <td>Same as both the <code class="literal">m</code> and <code class="literal">s</code> options</td>
          <td class="empty">&nbsp;</td>
         </tr>

         <tr>
          <td>l</td>
          <td>Finds longest matches</td>
          <td class="empty">&nbsp;</td>
         </tr>

         <tr>
          <td>n</td>
          <td>Ignores empty matches</td>
          <td class="empty">&nbsp;</td>
         </tr>

         <tr>
          <td>e</td>
          <td><span class="function"><a href="function.eval.php" class="function">eval()</a></span> resulting code</td>
          <td>Deprecated as of PHP 7.1.0 and removed as of PHP 8.0.0</td>
         </tr>

        </tbody>
       
      </table>

      <blockquote class="note"><p><strong class="note">Note</strong>: 
       <p class="para">
        The <code class="literal">&quot;e&quot;</code> option has no effect when set through <span class="function"><strong>mb_regex_set_options()</strong></span>.
        Use it with <span class="function"><a href="function.mb-ereg-replace.php" class="function">mb_ereg_replace()</a></span> or <span class="function"><a href="function.mb-eregi-replace.php" class="function">mb_eregi_replace()</a></span>.
       </p>
      </p></blockquote>
      <table class="doctable table">
       <caption><strong>Regex syntax modes (only one may be set)</strong></caption>
       
        <thead>
         <tr>
          <th>Mode</th>
          <th>Meaning</th>
         </tr>

        </thead>

        <tbody class="tbody">
         <tr>
          <td>j</td>
          <td>Java (Sun java.util.regex)</td>
         </tr>

         <tr>
          <td>u</td>
          <td>GNU regex</td>
         </tr>

         <tr>
          <td>g</td>
          <td>grep</td>
         </tr>

         <tr>
          <td>c</td>
          <td>Emacs</td>
         </tr>

         <tr>
          <td>r</td>
          <td>Ruby</td>
         </tr>

         <tr>
          <td>z</td>
          <td>Perl</td>
         </tr>

         <tr>
          <td>b</td>
          <td>POSIX Basic regex</td>
         </tr>

         <tr>
          <td>d</td>
          <td>POSIX Extended regex</td>
         </tr>

        </tbody>
       
      </table>

     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mb-regex-set-options-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   The previous options. If <code class="parameter">options</code> is omitted or <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, 
   it returns the <span class="type"><a href="language.types.string.php" class="type string">string</a></span> that describes the current options.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.mb-regex-set-options-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       If the parameter <code class="parameter">options</code> is given and not <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, the <em>previous</em>
       options are returned. Formerly, the <em>current</em> options have been returned.
      </td>
     </tr>

     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">options</code> is nullable now.
      </td>
     </tr>

     <tr>
      <td>8.0.0</td>
      <td>
       The <code class="literal">&quot;e&quot;</code> option now throws a <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span>.
      </td>
     </tr>

     <tr>
      <td>7.1.0</td>
      <td>
       The <code class="literal">&quot;e&quot;</code> option now emits an <strong><code><a href="errorfunc.constants.php#constant.e-deprecated">E_DEPRECATED</a></code></strong>.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.mb-regex-set-options-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.mb-split.php" class="function" rel="rdfs-seeAlso">mb_split()</a> - Split multibyte string using regular expression</span></li>
    <li><span class="function"><a href="function.mb-ereg.php" class="function" rel="rdfs-seeAlso">mb_ereg()</a> - Regular expression match with multibyte support</span></li>
    <li><span class="function"><a href="function.mb-eregi.php" class="function" rel="rdfs-seeAlso">mb_eregi()</a> - Regular expression match ignoring case with multibyte support</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>