<?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 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.mb-ereg-replace.php',
    1 => 'mb_ereg_replace',
    2 => 'マルチバイト文字列に正規表現による置換を行う',
  ),
  'up' => 
  array (
    0 => 'ref.mbstring.php',
    1 => 'マルチバイト文字列 関数',
  ),
  'prev' => 
  array (
    0 => 'function.mb-ereg-match.php',
    1 => 'mb_ereg_match',
  ),
  'next' => 
  array (
    0 => 'function.mb-ereg-replace-callback.php',
    1 => 'mb_ereg_replace_callback',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/mbstring/functions/mb-ereg-replace.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.mb-ereg-replace" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_ereg_replace</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">mb_ereg_replace</span> &mdash; <span class="dc-title">マルチバイト文字列に正規表現による置換を行う</span></p>

 </div>
   
 <div class="refsect1 description" id="refsect1-function.mb-ereg-replace-description">
  <h3 class="title">説明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mb_ereg_replace</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$pattern</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$replacement</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$string</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<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><br>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span></div>

  <p class="simpara">
   <code class="parameter">string</code> から
   <code class="parameter">pattern</code> にマッチする文字列を探し、
   見つかった文字列を <code class="parameter">replacement</code>
   で置換します。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mb-ereg-replace-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">pattern</code></dt>
     <dd>
      <p class="para">
       正規表現パターン。
      </p>
      <p class="para">
       マルチバイト文字を <code class="parameter">pattern</code>
       で使用することができます。
      </p>
     </dd>
    
    
     <dt><code class="parameter">replacement</code></dt>
     <dd>
      <p class="para">
       置換文字列。
      </p>
     </dd>
    
    
     <dt><code class="parameter">string</code></dt>
     <dd>
      <p class="para">
       調べたい文字列。
      </p>
     </dd>
    
    
     <dt><code class="parameter">options</code></dt>
     <dd>
      <span class="simpara">
       検索オプション。説明は、<span class="function"><a href="function.mb-regex-set-options.php" class="function">mb_regex_set_options()</a></span> を参照ください。
      </span>
     </dd>
    
   </dl>
  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.mb-ereg-replace-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
    成功した場合に結果の文字列、エラー時に <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します。
    <code class="parameter">string</code> が現在のエンコーディングに照らして不正な場合は、<strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> を返します。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.mb-ereg-replace-changelog">
  <h3 class="title">変更履歴</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>バージョン</th>
       <th>説明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>8.0.0</td>
       <td>
        <code class="parameter">options</code> は、nullable になりました。
       </td>
      </tr>

      <tr>
       <td>7.1.0</td>
       <td>
        この関数は、現在のエンコーディングに照らして <code class="parameter">string</code>
        が正しいかをチェックするようになりました。
       </td>
      </tr>

      <tr>
       <td>7.1.0</td>
       <td>
        <code class="literal">e</code> 修飾子が非推奨になりました。
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.mb-ereg-replace-notes">
  <h3 class="title">注意</h3>
  
  <blockquote class="note"><p><strong class="note">注意</strong>: <p class="para">内部エンコーディングあるいは
<span class="function"><a href="function.mb-regex-encoding.php" class="function">mb_regex_encoding()</a></span> で指定した文字エンコーディングを、
この関数の文字エンコーディングとして使用します。</p></p></blockquote>
  <div class="warning"><strong class="warning">警告</strong><p class="para">信頼できない入力に対しては、
絶対に <code class="literal">e</code> 修正子を使用してはいけません。
(<span class="function"><a href="function.preg-replace.php" class="function">preg_replace()</a></span> と同様、) 自動的なエスケープは行いません。
このことを忘れていると、自分の書いたアプリケーションにリモートコード実行の脆弱性を作りこんでしまうことになります。</p></div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.mb-ereg-replace-seealso">
  <h3 class="title">参考</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.mb-regex-encoding.php" class="function" rel="rdfs-seeAlso">mb_regex_encoding()</a> - 現在のマルチバイト正規表現用のエンコーディングを取得または設定する</span></li>
    <li><span class="function"><a href="function.mb-eregi-replace.php" class="function" rel="rdfs-seeAlso">mb_eregi_replace()</a> - マルチバイト文字列に大文字小文字を区別せずに正規表現による置換を行う</span></li>
   </ul>
  </p>
 </div>


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