uTools-Manuals/docs/php/eregi_replace.html
2019-04-28 19:00:34 +08:00

45 lines
3.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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>不区分大小写的正则表达式替换</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.eregi-replace" class="refentry">
<div class="refnamediv">
<h1 class="refname">eregi_replace</h1>
<p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">eregi_replace</span> &mdash; <span class="dc-title">不区分大小写的正则表达式替换</span></p>
</div>
<div class="refsect1 unknown-unknown-unknown-seealsr" id="refsect1-function.eregi-replace-unknown-unknown-unknown-seealsr">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>eregi_replace</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$pattern</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$replacement</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$string</code></span>
) : <span class="type">string</span></div>
<p class="para rdfs-comment">
本函数和 <span class="function"><a href="ereg_replace.html" class="function">ereg_replace()</a></span>
完全相同,只除了在匹配字母字符时忽略大小写的区别。
</p>
<p class="para">
<div class="example" id="example-5885">
<p><strong>Example #1 高亮搜索结果</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$pattern&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'(&gt;[^&lt;]*)('</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">quotemeta</span><span style="color: #007700">(</span><span style="color: #0000BB">$_GET</span><span style="color: #007700">[</span><span style="color: #DD0000">'search'</span><span style="color: #007700">])&nbsp;.</span><span style="color: #DD0000">')'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$replacement&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'\\1&lt;span&nbsp;class="search"&gt;\\2&lt;/span&gt;'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$body&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">eregi_replace</span><span style="color: #007700">(</span><span style="color: #0000BB">$pattern</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$replacement</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$body</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
<p class="para">
参见 <span class="function"><a href="ereg.html" class="function">ereg()</a></span><span class="function"><a href="eregi.html" class="function">eregi()</a></span>
<span class="function"><a href="ereg_replace.html" class="function">ereg_replace()</a></span>
</p>
</div>
</div></div></div></body></html>