<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=193345&amp;view=findpost&amp;p=1622343</guid>
        <pubDate>Tue, 03 Jul 2007 08:19:21 +0000</pubDate>
        <title>Замена текста по маске</title>
        <link>https://forum.sources.ru/index.php?showtopic=193345&amp;view=findpost&amp;p=1622343</link>
        <description><![CDATA[Krants: Имели ввиду &quot;&#092;. =&gt; &#092;&#092;.&quot; ?<br>
ну а смысл, все равно эти замены невозможно учесть, т.к. в искомом для замены тексте, могут быть и маски и текст&#33;<br>
а различить в подобном случае(по сабжу) невозможно&#33;<br>
Разве что, если б переменная <strong class='tag-b'>mask</strong> имела бы тип, типа записи:<br>
TList=record<br>
  Substr:array of string;<br>
  Mask:array of boolean;<br>
  Text:string;<br>
...<br>
end;<br>
<br>
где Text:=Substr[0]+..+Substr[n];<br>
а массив Mask говорил бы где Sumstr маска а где текст.<br>
И только тогда-бы логика замены была актуальна для любых вариантов набора сиволов&#33; <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2007-07-03T13:15:02+04:00">03.07.07, 09:15</time></span></span><br>
&gt;&gt;Soul :)<br>
Хотя..., примите плз извенения, за поспешные выводы...<br>
Просто жара-лето, как-то недумается)<br>
Если хорошенько подготовить строку mask перед заменой, типа:<br>
op:= mask;<br>
op:=StringReplace(op,&#39;&#092;&#39;,&#39;&#092;&#092;&#39;,[rfReplaceAll]);<br>
op:=StringReplace(op,&#39;+&#39;,&#39;&#092;+&#39;,[rfReplaceAll]);<br>
op:=StringReplace(op,&#39;[&#39;,&#39;&#092;[&#39;,[rfReplaceAll]);<br>
op:=StringReplace(op,&#39;.&#39;,&#39;&#092;.&#39;,[rfReplaceAll]);<br>
...<br>
op:=StringReplace(op,&#39;?&#39;,&#39;.&#39;,[rfReplaceAll]);<br>
op:=StringReplace(op,&#39;*&#39;,&#39;.*&#39;,[rfReplaceAll]);<br>
то будет выходить нормальный результат)<br>
<br>
ЗЫ: Но все же, если что, сообщу...<br>
ЗЗЫ: И Вы тоже, если найдете готовый алгоритм, сообщите плз...]]></description>
        <author>Krants</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=193345&amp;view=findpost&amp;p=1622312</guid>
        <pubDate>Tue, 03 Jul 2007 08:03:53 +0000</pubDate>
        <title>Замена текста по маске</title>
        <link>https://forum.sources.ru/index.php?showtopic=193345&amp;view=findpost&amp;p=1622312</link>
        <description><![CDATA[Soul :): Может все-таки документацию почитаешь?  :angry: <br><br>&#092;. =&gt; &#092;&#092;&#092;.]]></description>
        <author>Soul :)</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=193345&amp;view=findpost&amp;p=1622296</guid>
        <pubDate>Tue, 03 Jul 2007 07:55:54 +0000</pubDate>
        <title>Замена текста по маске</title>
        <link>https://forum.sources.ru/index.php?showtopic=193345&amp;view=findpost&amp;p=1622296</link>
        <description><![CDATA[Krants: Тогда возможен другой недочет:<br>При вычете в строке &quot;9&#092;.99&quot; текста по маске &quot;9&#092;.&quot; выходит: &quot;9&#092;.99&quot; - т.е. ничего не выходит&#33;]]></description>
        <author>Krants</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=193345&amp;view=findpost&amp;p=1622267</guid>
        <pubDate>Tue, 03 Jul 2007 07:34:45 +0000</pubDate>
        <title>Замена текста по маске</title>
        <link>https://forum.sources.ru/index.php?showtopic=193345&amp;view=findpost&amp;p=1622267</link>
        <description><![CDATA[Soul :): . =&gt; &#092;.]]></description>
        <author>Soul :)</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=193345&amp;view=findpost&amp;p=1622254</guid>
        <pubDate>Tue, 03 Jul 2007 07:18:51 +0000</pubDate>
        <title>Замена текста по маске</title>
        <link>https://forum.sources.ru/index.php?showtopic=193345&amp;view=findpost&amp;p=1622254</link>
        <description><![CDATA[Krants: Спасибо за раскрытый ответ, но в TRegExpr мне эти точки не очень нравятся, сбивается логика, да и к тому же в некоторых случаях она нарушена, может ошибаюсь но вот к примеру:<br>В &quot;Exele&quot; из &quot;9.99&quot; вычитываю &quot;9.&quot; выходит: &quot;99&quot;<br>В TRegExpr:<br>StrReplaceRegex(const s,mask,replace: string): string;<br>StrReplaceRegex(&quot;9.99&quot;,&quot;9.&quot;,&quot;&quot;)=&gt;&quot;&quot; - удаляет все&#33;<br>Имеется ввиду, если в маске существуют точка(и), то TRegExpr воспринимает ее как спецсимвол а не как точку&#33;]]></description>
        <author>Krants</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=193345&amp;view=findpost&amp;p=1621775</guid>
        <pubDate>Mon, 02 Jul 2007 16:40:08 +0000</pubDate>
        <title>Замена текста по маске</title>
        <link>https://forum.sources.ru/index.php?showtopic=193345&amp;view=findpost&amp;p=1621775</link>
        <description><![CDATA[ors_archangel: <a class='tag-url' href='http://www.regexpstudio.com/RU/TRegExpr/TRegExpr.html' target='_blank'>TRegExpr library</a> <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2007-07-02T16:48:40+00:00">02.07.07, 16:48</time></span></span><br>
Пример:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">uses</div><div class="code_line">&nbsp;&nbsp;regexpr;</div><div class="code_line">&nbsp;</div><div class="code_line">function StrReplaceRegex(const s,mask,replace: string): string;</div><div class="code_line">var</div><div class="code_line">&nbsp;&nbsp;regex: TRegExpr;</div><div class="code_line">begin</div><div class="code_line">&nbsp;&nbsp;regex := TRegExpr.Create;</div><div class="code_line">&nbsp;&nbsp;regex.Expression := mask;</div><div class="code_line">&nbsp;&nbsp;result := regex.Replace(s,replace);</div><div class="code_line">&nbsp;&nbsp;regex.free;</div><div class="code_line">end;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">procedure TForm1.Button1Click(Sender: TObject);</div><div class="code_line">begin</div><div class="code_line">&nbsp;&nbsp;ShowMessage(StrReplaceRegex(&#39;Тут был Вася!&#39;,&#39;. Вася.*&#39;,&#39;ли Вася и Петя&#39;));</div><div class="code_line">end;</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script> <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2007-07-02T16:52:33+00:00">02.07.07, 16:52</time></span></span><br>
Точка (&#39;.&#39;) соответсует wildcard&#39;у &#39;?&#39;, а если после символа стоит звёздочка (&#39;*&#39;), значит он может повторяться любое количество раз, т.е. regex&#39;овское &#39;.?&#39; эквивалентно DOS-овскому &#39;*&#39;. Подробнее смотри на том же сайте: <a class='tag-url' href='http://www.regexpstudio.com/RU/TRegExpr/Help/regexp_syntax.html' target='_blank'>Синтаксис</a>]]></description>
        <author>ors_archangel</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=193345&amp;view=findpost&amp;p=1620984</guid>
        <pubDate>Mon, 02 Jul 2007 07:16:18 +0000</pubDate>
        <title>Замена текста по маске</title>
        <link>https://forum.sources.ru/index.php?showtopic=193345&amp;view=findpost&amp;p=1620984</link>
        <description><![CDATA[Krants: Добрый день, подскажите плз.<br>функцию либо алгоритм замены текста в строке по маске(?*)<br><br>типа:<br>function StringMaskReplace(Text,MaskSubStr,NewSubStr:string):string;<br><br>StringMaskReplace(&quot;Тут был Вася&quot;,&quot;? Вася*&quot;,&quot;ли Вася и Петя&quot;)<br>=&gt;&quot;Тут были Вася и Петя&quot;<br><br>Зызб)]]></description>
        <author>Krants</author>
        <category>Алгоритмы</category>
      </item>
	
      </channel>
      </rss>
	