<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: RegExMatch и подшаблоны]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=8057&amp;type=atom" />
	<updated>2013-02-14T21:00:36Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=8057</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegExMatch и подшаблоны]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=69513#p69513" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>someString:=&quot;white black yellow marine other&quot;

Loop, Parse, someString, % A_Space
   MsgBox, 262144, % A_Index &quot;, &quot;A_LineNumber, % currentColor:=A_LoopField ;, 1
Until, A_LoopField=&quot;yellow&quot;

MsgBox, 262144, % A_LineNumber, % &quot;stop on: &quot;currentColor
ExitApp</code></pre></div><div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>...что такое Until?</p></blockquote></div><p>Проверка состояния переменных после каждой итерации, и соответственно прекращение цикла если состояние определённой переменной совпадает с выражением.</p>]]></content>
			<author>
				<name><![CDATA[Grey]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25792</uri>
			</author>
			<updated>2013-02-14T21:00:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=69513#p69513</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegExMatch и подшаблоны]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=69512#p69512" />
			<content type="html"><![CDATA[<p><a href="http://l.autohotkey.net/docs/commands/Until.htm">http://l.autohotkey.net/docs/commands/Until.htm</a><br />Только непонятно, чем лучше.<br />Я бы вообще сделал бы так<br /></p><div class="codebox"><pre><code>ListVars
WinSet, AlwaysOnTop, On, A
WinMove, A,, 888, 110, 892, 812
WinSet, Style, -0xC00000, A
Loop
{
   a++
   ListVars
   MsgBox, 262144, % A_LineNumber, % A_Index ;, 1
   if a=2
      break
}
ListVars
MsgBox, 262144, % A_LineNumber, % &quot;End&quot;
ExitApp</code></pre></div><p>А все эти новшества меня только запутывают, например как &quot;if else&quot; записывать одной строкой.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2013-02-14T20:55:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=69512#p69512</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegExMatch и подшаблоны]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=69511#p69511" />
			<content type="html"><![CDATA[<p>С While вроде дошло. Теперь непонятно с &quot;Loop&quot;... Где тут условие выхода, если условие это строка: </p><div class="codebox"><pre><code>Until, а=2</code></pre></div><p> то оно же ниже расположено. И что такое Until?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2013-02-14T20:36:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=69511#p69511</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegExMatch и подшаблоны]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=69510#p69510" />
			<content type="html"><![CDATA[<p>Для того, чтобы отслеживать состояние переменных в нутри цикла, лучше использовать связку <strong>Loop Until</strong>:</p><div class="codebox"><pre><code>ListVars
WinSet, AlwaysOnTop, On, A
WinMove, A,, 888, 110, 892, 812
WinSet, Style, -0xC00000, A

Loop
{
   а++
   ListVars
   MsgBox, 262144, % A_LineNumber, % A_Index ;, 1
}
Until, а=2
ListVars
MsgBox, 262144, % A_LineNumber, % &quot;End&quot;
ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Grey]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25792</uri>
			</author>
			<updated>2013-02-14T20:31:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=69510#p69510</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegExMatch и подшаблоны]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=69509#p69509" />
			<content type="html"><![CDATA[<p>Спасибо, очень наглядно! То есть &quot;While&quot; это цикл в котором сразу задаётся условие выхода?<br />И как (синтаксис) задать условие например: если А = 2 то выход.<br /></p><div class="codebox"><pre><code>While, (А = &quot;2&quot;)
{
А++
MsgBox %A_Index%
}
MsgBox While!</code></pre></div><p>или есть ограниченный перечень условий?</p> <br /><ul><li><p>Вроде понял, при каждой итерации условие должно выполнятся, и когда &quot;ложь&quot;, то выход.</p></li></ul>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2013-02-14T20:08:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=69509#p69509</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegExMatch и подшаблоны]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=69508#p69508" />
			<content type="html"><![CDATA[<p>Имеется ввиду, что пока то что возвращает RegExMatch (переменная <strong>pos</strong>) будет не ровна нулю, перебор в цикле будет происходить, жмём пробел для прогресса:</p><div class="codebox"><pre><code>ListVars
WinSet, AlwaysOnTop, On, A
WinMove, A,, 888, 110, 892, 812
WinSet, Style, -0xC00000, A

text_:=&quot;Times New Roman;color:00F&gt;Calgary Flames&lt;/td&gt;&lt;/tr&gt;&quot;
     . &quot;&lt;tdcolor:00F&gt;Vancouver Canucks&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&quot;

m:=RegExFind(text_, &quot;F&gt;\K[^&lt;]+&quot;)

WinHide, A
MsgBox, 262144, % A_Space, % m.1 &quot;`n&quot;m.2

ExitApp

RegExFind(ByRef string, ByRef pattern)
{
   startPos:=1, EntryList:=[]

   While, pos:=RegExMatch(string, pattern, match, startPos)
   {
      EntryList.Insert(match), startPos:=pos+(IsObject(match) ? match.len:StrLen(match))
      _index:=A_Index, _line:=A_LineNumber
      ListVars
      Input, _, I, {vk20}
   }

   For _k, _v In EntryList
     `(A_Index&lt;=9 ? _k0%A_Index%:_k%A_Index%):=_k
   ,  (A_Index&lt;=9 ? _v0%A_Index%:_v%A_Index%):=_v
   ,  _maxIndex:=A_Index
   _line:=A_LineNumber
   ListVars
   Input, _, I, {vk20}

   Return, EntryList
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Grey]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25792</uri>
			</author>
			<updated>2013-02-14T20:07:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=69508#p69508</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegExMatch и подшаблоны]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=69499#p69499" />
			<content type="html"><![CDATA[<p>Подскажите что значит &quot;<strong>while</strong>&quot; в строке:<br /></p><div class="codebox"><pre><code>while pos := RegExMatch(string, pattern, match, startPos)</code></pre></div><p>поста №3, из справки ничего не понятно.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2013-02-14T18:10:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=69499#p69499</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegExMatch и подшаблоны]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=69380#p69380" />
			<content type="html"><![CDATA[<p>Да в сообщении 12 написано про ini-файл, ваши придирки к словам уже не относятся к теме, как и сообщение 16.</p>]]></content>
			<author>
				<name><![CDATA[Zohann]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26234</uri>
			</author>
			<updated>2013-02-12T03:46:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=69380#p69380</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegExMatch и подшаблоны]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=69368#p69368" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Zohann пишет:</cite><blockquote><p>Подскажите как создать <strong>массив</strong> хоккейных команд.</p></blockquote></div><div class="quotebox"><cite>Zohann пишет:</cite><blockquote><p>Я и не говорил про <strong>массив</strong></p></blockquote></div><p>Вот и я непонял 1 и 14 пост <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br /></p><div class="quotebox"><cite>Zohann пишет:</cite><blockquote><p>надо было создать инишку</p></blockquote></div><p>Об этом конечно мне надо было-бы догадаться самому.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2013-02-11T16:44:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=69368#p69368</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegExMatch и подшаблоны]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=69367#p69367" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>На массив непохоже</p></blockquote></div><p>Я и не говорил про массив, надо было создать инишку, что и получилось благодаря уважаемому <strong>creature.ws</strong>, при чутком руководстве <strong>ypppu</strong> и мудрым советам <strong>teadrinker</strong>.</p>]]></content>
			<author>
				<name><![CDATA[Zohann]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26234</uri>
			</author>
			<updated>2013-02-11T16:35:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=69367#p69367</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegExMatch и подшаблоны]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=69309#p69309" />
			<content type="html"><![CDATA[<p>Возник вопрос: <br />имеется массив, какой самый простой способ перевести его в многострочную переменную.То есть после каждой ссылки, количество которых заранее неизвестно, добавлять в переменную через &quot;`n&quot;.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2013-02-10T11:41:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=69309#p69309</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegExMatch и подшаблоны]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=69308#p69308" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>А я сделал прямо в функции Loop присвоение к переменной, типа out .= match &quot;=&quot; team &quot;`n&quot; (match - это еще одно соответсвие из text), а потом return out и записываю out в ini-файл.</p></blockquote></div><p>На массив непохоже, скорее просто многострочная переменная, что задачка попроще.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2013-02-10T11:04:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=69308#p69308</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegExMatch и подшаблоны]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=69307#p69307" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Zohann пишет:</cite><blockquote><p>Подскажите как создать массив хоккейных команд.</p></blockquote></div><p>Массив можно создавать только из футбольных команд. <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2013-02-10T10:52:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=69307#p69307</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegExMatch и подшаблоны]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=69304#p69304" />
			<content type="html"><![CDATA[<p>Зачем примеры, если есть однозначное определение.<br /></p><div class="codebox"><pre><code>MsgBox % RegExReplace(&quot;1`n2`n3`n4`n`n5`n6`n7&quot;, &quot;\n[^\n]+\K\n&quot;)</code></pre></div><p>Результат как при использовании (?&lt;=)</p>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2013-02-10T09:47:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=69304#p69304</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegExMatch и подшаблоны]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=69302#p69302" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Теперь эта фраза есть и в рунете <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p></blockquote></div><p>В рунете и на русском есть пара кратких описаний, но примеров нет. Понял только что исключает найденное (верно?) из дальнейшего поиска соответствий.<br /></p><div class="quotebox"><blockquote><p>а переменные Command%A_Index% нельзя\неудобно будет сделать глобальными</p></blockquote></div><p>А я сделал прямо в функции Loop присвоение к переменной, типа out .= match &quot;=&quot; team &quot;`n&quot; (match - это еще одно соответсвие из text), а потом return out и записываю out в ini-файл.</p>]]></content>
			<author>
				<name><![CDATA[Zohann]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26234</uri>
			</author>
			<updated>2013-02-10T09:07:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=69302#p69302</id>
		</entry>
</feed>
