Files
smarty/docs/ru/designers/language-modifiers/language-modifier-regex-replace.xml
2004-11-01 16:02:39 +00:00

88 lines
2.6 KiB
XML

<?xml version="1.0" encoding="windows-1251"?>
<!-- $Revision$ -->
<!-- EN-Revision: 1.1 Maintainer: tony2001 Status: ready -->
<sect1 id="language.modifier.regex.replace">
<title>regex_replace</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" />
<colspec colname="type" />
<colspec colname="required" />
<colspec colname="default" />
<colspec colname="desc" />
<thead>
<row>
<entry>Ïîçèöèÿ ïàðàìåòðà</entry>
<entry>Òèï</entry>
<entry>Îáÿçàòåëåí</entry>
<entry>Ïî óìîë÷àíèþ</entry>
<entry>Îïèñàíèå</entry>
</row>
</thead>
<tbody>
<row>
<entry>1</entry>
<entry>string</entry>
<entry>Äà</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>Ðåãóëÿðíîå âûðàæåíèå äëÿ çàìåíû.</entry>
</row>
<row>
<entry>2</entry>
<entry>string</entry>
<entry>Äà</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>Ñòðîêà äëÿ çàìåíû.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
Âûïîëíÿåòñÿ ïîèñê è çàìåíà ïî ðåãóëÿðíîìó âûðàæåíèþ â
ïåðåìåíííîé. Èñïîëüçóåòñÿ ñèíòàêñèñ äëÿ ôóíêöèè
preg_replace() èç ðóêîâîäñòâà ïî PHP.
</para>
<example>
<title>regex_replace</title>
<programlisting>
index.php:
$smarty = new Smarty;
$smarty-&gt;assign('articleTitle', "Infertility unlikely to\nbe passed on, experts say.");
$smarty-&gt;display('index.tpl');
index.tpl:
{* replace each carriage return, tab &amp; new line with a space *}
{$articleTitle}
{$articleTitle|regex_replace:"/[\r\t\n]/":" "}
OUTPUT:
Infertility unlikely to
be passed on, experts say.
Infertility unlikely to be passed on, experts say.</programlisting>
</example>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->