<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: RegEx получить из ini секции ключ, значение и комментирование]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=12650&amp;type=atom" />
	<updated>2017-05-02T16:29:51Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=12650</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegEx получить из ini секции ключ, значение и комментирование]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115612#p115612" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>OutputVar =
(
Test=123 ; /test
)
RegExMatch(OutputVar, &quot;(.*);(.*)&quot;, Found)
MsgBox, %Found2%</code></pre></div><p>Вообще следовало задавать вопрос в теме про RegEx.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2017-05-02T16:29:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115612#p115612</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegEx получить из ini секции ключ, значение и комментирование]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115610#p115610" />
			<content type="html"><![CDATA[<p><strong>ypppu</strong>, с вами можно согласиться, но я ищу ответ с RegEx.</p>]]></content>
			<author>
				<name><![CDATA[Странникх]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30605</uri>
			</author>
			<updated>2017-05-02T14:33:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115610#p115610</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegEx получить из ini секции ключ, значение и комментирование]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115596#p115596" />
			<content type="html"><![CDATA[<p>Кому как удобно и что называть мусором. Вы хотите нестандартную обработку Ini для частного случая.<br />А если будет Ini на 1000 строк, про удобство редактирования можно забыть. В скрипте обрабатывать удобнее стандартными методами.</p><p><em>Добавлено:</em> А какие вообще трудности с редактированием? Каждая секция имеет своё имя. В том же Блокноте по Ctrl+F можно быстро перепрыгнуть на нужный пункт.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2017-05-01T19:20:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115596#p115596</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegEx получить из ini секции ключ, значение и комментирование]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115595#p115595" />
			<content type="html"><![CDATA[<p>Не удобно, как редактировать, так и вообще обрабатывать в скрипте. Это получается к каждому ключу надо второй строчкой дописывать линию комментирования. Вы представляете какой длинный будет тогда Ini файл если в нем много ключей? </p><p>А так хоть и криво написано, но работает, зато без &quot;мусора&quot; в Ini.</p>]]></content>
			<author>
				<name><![CDATA[Странникх]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30605</uri>
			</author>
			<updated>2017-05-01T19:08:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115595#p115595</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegEx получить из ini секции ключ, значение и комментирование]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115593#p115593" />
			<content type="html"><![CDATA[<p>Я имею в виду привести ini-файл к виду<br /></p><div class="codebox"><pre><code>[General]
Test=123
Comment = test</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2017-05-01T19:02:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115593#p115593</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegEx получить из ini секции ключ, значение и комментирование]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115592#p115592" />
			<content type="html"><![CDATA[<p><strong>ypppu</strong>, а как если<br /></p><div class="codebox"><pre><code>[v1.0.90+]: Omit the Key parameter to read an entire section. Comments and empty lines are omitted. Only the first 65,533 characters of the section are retrieved.</code></pre></div><p>Из команды IniRead не получить комментирование. Только сплошной линией в переменной, но и ее тогда пришлось бы разбивать через RegEx</p>]]></content>
			<author>
				<name><![CDATA[Странникх]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30605</uri>
			</author>
			<updated>2017-05-01T18:53:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115592#p115592</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: RegEx получить из ini секции ключ, значение и комментирование]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115591#p115591" />
			<content type="html"><![CDATA[<p>Почему не хотите просто добавить в раздел&nbsp; дополнительный параметр (например Comment) и считывать его стандартным способом?</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2017-05-01T18:42:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115591#p115591</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: RegEx получить из ini секции ключ, значение и комментирование]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115589#p115589" />
			<content type="html"><![CDATA[<p>Ini:<br /></p><div class="codebox"><pre><code>[General]
Test=123 ; /test</code></pre></div><p>Код:<br /></p><div class="codebox"><pre><code>	IniRead, OutputVar, % Path_ini, General
	Loop, Parse, % OutputVar, `n
		If RegexMatch( A_LoopField, &quot;^\s*(?&lt;_key&gt;[^=]*)=(?&lt;_value&gt;.*);(?&lt;_description&gt;.*)&quot;, line )
			MsgBox, % line_key &quot;`n&quot;  line_value &quot;`n&quot; line_description</code></pre></div><p>Если знак ; не встречается, то код перестает доставать шаблоны.</p><p>В Regex вообще не силен, и даже не знаю где посмотреть туториал для чайников. Справка по нему выглядит невероятно пугающее и едва понятной для новичка.</p><p>Пробовал сделать шаблон с условием новой строки или пробел (как трактуется пробел тоже не нашел в справке кстати)- <br /></p><div class="codebox"><pre><code>&quot;^\s*(?&lt;_key&gt;[^=]*)=(?&lt;_value&gt;.*);|`n(?&lt;_description&gt;.*)&quot;</code></pre></div><p>Не помогает.</p><p>Пока проблема решена так:<br /></p><div class="codebox"><pre><code>		If (RegexMatch( A_LoopField, &quot;^\s*(?&lt;_key&gt;[^=]*)=(?&lt;_value&gt;.*);(?&lt;_description&gt;[^;].*)&quot;, line) = 1 || RegexMatch( A_LoopField, &quot;^\s*(?&lt;_key&gt;[^=]*)=(?&lt;_value&gt;.*)&quot;, line) = 1)
			MsgBox, % line_key &quot;`n`n&quot; line_value &quot;`n`n&quot; line_description </code></pre></div>]]></content>
			<author>
				<name><![CDATA[Странникх]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30605</uri>
			</author>
			<updated>2017-05-01T18:03:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115589#p115589</id>
		</entry>
</feed>
