<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Поиск и замена нескольких строк]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=7273</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=7273&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Поиск и замена нескольких строк».]]></description>
		<lastBuildDate>Tue, 19 Feb 2013 23:51:59 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Поиск и замена нескольких строк]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=69651#p69651</link>
			<description><![CDATA[<div class="codebox"><pre><code>
Str := &quot;1001&quot; , List := [&quot;Первое&quot;, &quot;Второе&quot;, &quot;Третье&quot;, &quot;Четвёртое&quot;]
    for index, value in list
        SubStr(Str, index, 1) = 1 ? Res .= value . &quot;+&quot;
MsgBox  %Res%
</code></pre></div><p>или лучше без массива:<br /></p><div class="codebox"><pre><code>
Str := &quot;1010&quot; , List := &quot;Первое|Второе|Третье|Четвёртое&quot;
    Loop, Parse, List, |
        SubStr(Str, A_Index, 1) = 1 ? Res .= A_LoopField . &quot;+&quot;
MsgBox  %Res%
</code></pre></div><p>плодить лишние index и value <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Tue, 19 Feb 2013 23:51:59 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=69651#p69651</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Поиск и замена нескольких строк]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=69650#p69650</link>
			<description><![CDATA[<p>Прикольно, я и незнал что тернарные операторы используются внутри RegEx для присваивания.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Tue, 19 Feb 2013 23:33:32 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=69650#p69650</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Поиск и замена нескольких строк]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=69649#p69649</link>
			<description><![CDATA[<div class="codebox"><pre><code>someVar:=0101, pattern:=&quot;O)(1)&quot;, sArr:=[&quot;Первое&quot;, &quot;Второе&quot;, &quot;Третье&quot;, &quot;Четвёртое&quot;]

While, RegExMatch(someVar, pattern, outVar, outVar.Pos(1) ? outVar.Pos(1)+outVar.Len:1)
   outList.=sArr[outVar.Pos]

MsgBox, % 262 . (outList ? 208:160)
      , % outList ? &quot;Result:&quot;:&quot;Oops!&quot;
      , % outList ? outList:&quot;No matches&quot;
      , % (outList ? 3:0) . .5</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Tue, 19 Feb 2013 23:25:28 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=69649#p69649</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Поиск и замена нескольких строк]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=69647#p69647</link>
			<description><![CDATA[<p>Настолько сложно, что даже непонимаю как это использовать <img src="//forum.script-coding.com/img/smilies/neutral.png" width="15" height="15" /><br />Можно на примере:<br /></p><div class="codebox"><pre><code>Str := &quot;0101&quot;
****
Res := &quot;ВтороеЧетвёртое&quot;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Tue, 19 Feb 2013 22:41:22 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=69647#p69647</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Поиск и замена нескольких строк]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=69646#p69646</link>
			<description><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>...попроще, без массивов...</p></blockquote></div><div class="codebox"><pre><code>str:=&quot;ICQ - 00011110111000111101&quot;, pattern:=&quot;(1)&quot;, cnt:=0

While, match:=RegExMatch(str, pattern, outVar, match ? match+StrLen(outVar):1)
{
   cnt++
   While, outVar%A_Index%
      tmp:=&quot;match position: &quot;match+(StrLen(outVar)-StrLen(outVar%A_Index%))&quot; (&quot;cnt &quot;)`n&quot;
   outList.=RTrim(tmp, &quot;`n&quot;)&quot;`n&quot;, tmp:=&quot;&quot;
}

MsgBox, % 262 . (outList ? 208:160)
      , % outList ? &quot;Result:&quot;:&quot;Oops!&quot;
      , % outList ? RTrim(outList, &quot;`n&quot;):&quot;No matches&quot;
      , % (outList ? 3:0) . .5</code></pre></div><p>Или:</p><div class="codebox"><pre><code>str:=&quot;ICQ - 00011110111000111101&quot;, pattern:=&quot;O)(1)&quot;

While, RegExMatch(str, pattern, outVar , outVar.Pos(1) ? outVar.Pos(1)+outVar.Len:1)
   outList.=&quot;match position: &quot;outVar.Pos &quot; (&quot;A_Index &quot;)`n&quot;

MsgBox, % 262 . (outList ? 208:160)
      , % outList ? &quot;Result:&quot;:&quot;Oops!&quot;
      , % outList ? RTrim(outList, &quot;`n&quot;):&quot;No matches&quot;
      , % (outList ? 3:0) . .5</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Tue, 19 Feb 2013 22:09:02 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=69646#p69646</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Поиск и замена нескольких строк]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=69637#p69637</link>
			<description><![CDATA[<p>Как бы мне на выходе из этой строки:<br /><em>Str := &quot;1010&quot;</em><br />попроще, без массивов и.т.п. получить:<br /><em>Res := &quot;ПервоеТретье&quot;</em><br />или:<br /><em>Str := &quot;0101&quot;<br />Res := &quot;ВтороеЧетвёртое&quot;</em></p><p>В строке могут быть только 1 и 0, если все нули то результат пустой.<br />------------------------------------<br />ничего хорошего пока непридумал:<br /></p><div class="codebox"><pre><code>Str := &quot;1010&quot;
MsgBox  % RegExReplace(RegExReplace(RegExReplace(SubStr(Str,1,1),&quot;1&quot;,&quot;Первое&quot;)SubStr(Str,2,1),&quot;1&quot;,&quot;Второе&quot;)
 . RegExReplace(RegExReplace(SubStr(Str,3,1),&quot;1&quot;,&quot;Третье&quot;)SubStr(Str,4,1),&quot;1&quot;,&quot;Четвёртое&quot;),&quot;0&quot;)</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Tue, 19 Feb 2013 16:57:34 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=69637#p69637</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Поиск и замена нескольких строк]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=69632#p69632</link>
			<description><![CDATA[<p><em>Слона</em> (!), и не заметил. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Tue, 19 Feb 2013 02:16:14 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=69632#p69632</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Поиск и замена нескольких строк]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=69629#p69629</link>
			<description><![CDATA[<p>Коллега <strong>Grey</strong> перемудрил слегка <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p><div class="codebox"><pre><code>Mod = Win+Alt+Shift+Ctrl+Результат
list := {Win: &quot;#&quot;, Ctrl: &quot;^&quot;, Alt: &quot;!&quot;, Shift: &quot;+&quot;}

for k, v in list
   StringReplace, Mod, Mod, %k%+, %v%

MsgBox  %Mod%</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Mon, 18 Feb 2013 22:30:50 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=69629#p69629</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Поиск и замена нескольких строк]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=69626#p69626</link>
			<description><![CDATA[<p>Вот так упростили <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Mon, 18 Feb 2013 20:33:43 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=69626#p69626</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Поиск и замена нескольких строк]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=69624#p69624</link>
			<description><![CDATA[<div class="codebox"><pre><code>str:=&quot;Alt+Shift+Ctrl+Win+result&quot;, d:=&quot;+&quot;
arr:={Win:&quot;#&quot;, Alt:&quot;!&quot;, Shift:&quot;+&quot;, Ctrl:&quot;^&quot;}

StringSplit, outArr, str, % d

Loop, % outArr0-1
   StringReplace, str, str, % outArr%A_Index% d, % arr[outArr%A_Index%]

MsgBox, 262144, % A_Space, % str</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Mon, 18 Feb 2013 20:28:38 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=69624#p69624</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Поиск и замена нескольких строк]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=69623#p69623</link>
			<description><![CDATA[<p>Всю голову сломал, подскажите как упростить код:<br /></p><div class="codebox"><pre><code>
Mod = Win+Alt+Shift+Ctrl+Результат
StringReplace, Pref, Mod, Win+, #
StringReplace, Pref, Pref, Ctrl+, ^
StringReplace, Pref, Pref, Alt+, !
StringReplace, Pref, Pref, Shift+, +
MsgBox  %Pref%
</code></pre></div><p>на каком месте будет например Win+ неизвестно.<br />пока вот так получилось:<br /></p><div class="codebox"><pre><code>Mod = Win+Alt+Shift+Ctrl+Результат
MsgBox  % RegExReplace(RegExReplace(RegExReplace(RegExReplace(Mod,&quot;Shift\+&quot;,&quot;+&quot;),&quot;Alt\+&quot;,&quot;!&quot;),&quot;Ctrl\+&quot;,&quot;^&quot;),&quot;Win\+&quot;,&quot;#&quot;)</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Mon, 18 Feb 2013 19:20:04 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=69623#p69623</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Поиск и замена нескольких строк]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=69540#p69540</link>
			<description><![CDATA[<p>Нет, это я поспешил.<br /></p><div class="codebox"><pre><code>MsgBox,, % &quot;&quot; := RegExMatch(&quot;str1`nstr2`nstr3`nstr4&quot;, &quot;`am)(?:.*\R){2}\K.+$&quot;, m),  % m</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (creature.ws)]]></author>
			<pubDate>Fri, 15 Feb 2013 11:55:02 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=69540#p69540</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Поиск и замена нескольких строк]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=69539#p69539</link>
			<description><![CDATA[<p>Спасибо! <br />С одной строкой я конечно погорячился....</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Fri, 15 Feb 2013 11:45:36 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=69539#p69539</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Поиск и замена нескольких строк]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=69538#p69538</link>
			<description><![CDATA[<p>C учётом, что RegExMatch возвращает номер символа с которого начинается соответствие выражению, а команда MsgBox не может быть записана в одну строку с выражением&nbsp; — в одну строку не получится.<br /></p><div class="codebox"><pre><code>text := &quot;
(
str1
str2
str3
str4
)&quot;
RegExMatch(text, &quot;`am)(?:.*\R){2}\K.+$&quot;, m)
MsgBox % m</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (creature.ws)]]></author>
			<pubDate>Fri, 15 Feb 2013 11:38:37 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=69538#p69538</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Поиск и замена нескольких строк]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=69537#p69537</link>
			<description><![CDATA[<p>А можно ли по аналогии:<br /></p><div class="codebox"><pre><code>
Loop, parse, clipboard, `n, `r
{
Str := A_LoopField 
if A_Index = 3
break
}
MsgBox %Str%
</code></pre></div><p>вернуть строку по её номеру?<br /></p><div class="codebox"><pre><code>MsgBox % RegExMatch (clipboard, &quot;***&quot;, 3строка)
</code></pre></div><p>&quot;одной строкой кода&quot;</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Fri, 15 Feb 2013 11:15:59 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=69537#p69537</guid>
		</item>
	</channel>
</rss>
