<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Удаление строки из текстового файла]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=12377&amp;type=atom" />
	<updated>2023-12-13T17:30:29Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=12377</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление строки из текстового файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=159738#p159738" />
			<content type="html"><![CDATA[<p>Угу, чуть проще:<br /></p><div class="codebox"><pre><code>literalRegex(str)
{
    return RegExReplace(str, &quot;\\E&quot;, &quot;\E\\E\Q&quot;)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2023-12-13T17:30:29Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=159738#p159738</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление строки из текстового файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=159732#p159732" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><div class="codebox"><pre><code>text =
(
Text_Text - Reason
Text_Text - Reason
Text_Text - Reason
Hex_Hex \ Reason1
)

search := &quot;Hex_Hex \ Reason1&quot;

MsgBox, % &quot;|&quot; RegExReplace(text, &quot;(^|(\R))\Q&quot; . search . &quot;\E(?(2)(?=(\R|$))|\R)&quot;) &quot;|&quot;</code></pre></div></blockquote></div><p>Здесь кроется ошибка, сам на нее недавно наткнулся и какое-то время не мог понять в чем причина.<br />Когда мы используем такой шаблон как &quot;\Q&quot; search &quot;\E&quot;, то надо строку конвертировать:<br /></p><div class="codebox"><pre><code>text =
(
Text_Text - Reason
Text_Text - Reason
Text_Text - Reason
Hex_Hex \E Reason1
)

search := &quot;Hex_Hex \E Reason1&quot;

MsgBox, % &quot;|&quot; RegExReplace(text, &quot;(^|(\R))\Q&quot; . search . &quot;\E(?(2)(?=(\R|$))|\R)&quot;) &quot;|&quot;
MsgBox, % &quot;|&quot; RegExReplace(text, &quot;(^|(\R))\Q&quot; . literalRegex(search) . &quot;\E(?(2)(?=(\R|$))|\R)&quot;) &quot;|&quot;

literalRegex(str)
{
   if InStr(str, &quot;\E&quot;, 1)
   {
      StringCaseSenseOld := A_StringCaseSense
      StringCaseSense, On
      str := StrReplace(str, &quot;\E&quot;, &quot;\E\\E\Q&quot;)
      StringCaseSense, % StringCaseSenseOld
   }
   return str
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2023-12-13T16:46:49Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=159732#p159732</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление строки из текстового файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=111755#p111755" />
			<content type="html"><![CDATA[<p><strong>Flasher</strong>. а, ну да, переписывает. Спасибо.</p>]]></content>
			<author>
				<name><![CDATA[svoboden]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34280</uri>
			</author>
			<updated>2017-02-01T13:10:39Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=111755#p111755</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление строки из текстового файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=111751#p111751" />
			<content type="html"><![CDATA[<p><strong>svoboden</strong><br />Я же <a href="http://forum.script-coding.com/viewtopic.php?pid=111616#p111616">показывал</a>.<br />Регулярку можно взять из примера выше.</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2017-02-01T12:25:22Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=111751#p111751</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление строки из текстового файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=111748#p111748" />
			<content type="html"><![CDATA[<p>Кто знает, можно ли заменить или удалить строку без использования команд: FileDelete, FileAppend. Спасибо!</p>]]></content>
			<author>
				<name><![CDATA[svoboden]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34280</uri>
			</author>
			<updated>2017-02-01T12:03:27Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=111748#p111748</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление строки из текстового файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=111694#p111694" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>text =
(
Text_Text - Reason
Text_Text - Reason
Text_Text - Reason
Hex_Hex \ Reason1
)

search := &quot;Hex_Hex \ Reason1&quot;

MsgBox, % &quot;|&quot; RegExReplace(text, &quot;(^|(\R))\Q&quot; . search . &quot;\E(?(2)(?=(\R|$))|\R)&quot;) &quot;|&quot;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-01-31T14:21:00Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=111694#p111694</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление строки из текстового файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=111630#p111630" />
			<content type="html"><![CDATA[<p><strong>belyankin12</strong>, ясно.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-01-28T18:12:02Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=111630#p111630</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление строки из текстового файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=111629#p111629" />
			<content type="html"><![CDATA[<p>Ух ты, парни, я уже решил проблему по своему. Teadrinker, может быть и выдает, я не пытался. Просто я не использую то, чего не понимаю. Я не хочу каждый раз вас напрягать, задавая глупые вопросы. Потому, когда мне предлагают решение проблемы, я запоминаю метод и потом, в будущем, я смогу это сделать самостоятельно.</p>]]></content>
			<author>
				<name><![CDATA[belyankin12]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34408</uri>
			</author>
			<updated>2017-01-28T18:07:23Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=111629#p111629</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление строки из текстового файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=111628#p111628" />
			<content type="html"><![CDATA[<p>А что, текст без пустой строки должен быть?</p>]]></content>
			<author>
				<name><![CDATA[svoboden]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34280</uri>
			</author>
			<updated>2017-01-28T17:59:30Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=111628#p111628</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление строки из текстового файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=111626#p111626" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p><strong>Flasher</strong>, твой вариант:</p></blockquote></div><p>Согласен.<br /></p><div class="quotebox"><blockquote><p>Уж не говоря о:</p></blockquote></div><p>Это было понятно. Спецсимволы не учитывал.</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2017-01-28T17:20:32Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=111626#p111626</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление строки из текстового файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=111625#p111625" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong><br /></p><div class="codebox"><pre><code>text =
(
Text_Text - Reason
Hex_Hex \ Reason1
test Hex_Hex \ Reason1
Text_Text - Reason
)

search := &quot;Hex_Hex \ Reason1&quot;
MsgBox, % &quot;|&quot; RegExReplace(text, &quot;(^|\R)\Q&quot; . search . &quot;\E(\R|$)&quot;, $1$2) &quot;|&quot; </code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-01-28T17:19:04Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=111625#p111625</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление строки из текстового файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=111624#p111624" />
			<content type="html"><![CDATA[<p><strong>svoboden</strong><br /></p><div class="codebox"><pre><code>OutputVar =
(
Text_Text - Reason
Hex_Hex - Reason1
Text_Text - Reason
Text_Text - Reason
)

StringReplace, FileName, OutputVar, Hex_Hex - Reason1
MsgBox, % FileName</code></pre></div><p>В этом примере пустая строка остаётся, а в этом</p><div class="codebox"><pre><code>OutputVar =
(
Text_Text - Reason
test Hex_Hex - Reason1
Text_Text - Reason
Text_Text - Reason
)

StringReplace, FileName, OutputVar, Hex_Hex - Reason1
MsgBox, % FileName</code></pre></div><p>вообще не то, что надо удаляется.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-01-28T17:16:56Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=111624#p111624</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление строки из текстового файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=111623#p111623" />
			<content type="html"><![CDATA[<p>Можно так:</p><div class="codebox"><pre><code>text =
(
Text_Text - Reason
test Hex_Hex \ Reason1
Text_Text - Reason
Hex_Hex \ Reason1
)

search := &quot;Hex_Hex \ Reason1&quot;
MsgBox, % &quot;|&quot; RegExReplace(text, &quot;(^|\R)\Q&quot; . search . &quot;\E(\R|$)&quot;, $1$2) &quot;|&quot; </code></pre></div><p>Хотя нет.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-01-28T17:15:40Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=111623#p111623</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление строки из текстового файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=111622#p111622" />
			<content type="html"><![CDATA[<p>teadrinker, а что в моем варианте ни так?</p>]]></content>
			<author>
				<name><![CDATA[svoboden]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34280</uri>
			</author>
			<updated>2017-01-28T17:11:27Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=111622#p111622</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление строки из текстового файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=111621#p111621" />
			<content type="html"><![CDATA[<p>Да, есть косяк, не углядел. Правильно так:<br /></p><div class="codebox"><pre><code>text =
(
Text_Text - Reason
test Hex_Hex \ Reason1
Text_Text - Reason
Hex_Hex \ Reason1
)

search := &quot;Hex_Hex \ Reason1&quot;
patt := &quot;^\Q&quot; . search . &quot;\E$&quot;
MsgBox, % &quot;|&quot; RegExReplace(text, &quot;m`a)\R&quot; . patt . &quot;|&quot; . patt . &quot;\R&quot;) &quot;|&quot;</code></pre></div><p><strong>Flasher</strong>, твой вариант:<br /></p><div class="codebox"><pre><code>All =
(
Hex_Hex - Reason1
Text_Text - Reason
Text_Text - Reason
Text_Text - Reason
)
StrDel := &quot;Hex_Hex - Reason1&quot;

MsgBox, % &quot;|&quot; RegExReplace(All, &quot;(^|\R)&quot; . StrDel . &quot;|&quot; . StrDel . &quot;(\R|$)&quot;) &quot;|&quot;</code></pre></div><p>Уж не говоря о:<br /></p><div class="codebox"><pre><code>All =
(
Hex_Hex \ Reason1
Text_Text - Reason
Text_Text - Reason
Text_Text - Reason
)
StrDel := &quot;Hex_Hex \ Reason1&quot;

MsgBox, % &quot;|&quot; RegExReplace(All, &quot;(^|\R)&quot; . StrDel . &quot;|&quot; . StrDel . &quot;(\R|$)&quot;) &quot;|&quot;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-01-28T17:03:33Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=111621#p111621</id>
		</entry>
</feed>
