<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=8486&amp;type=atom" />
	<updated>2022-03-14T22:03:08Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=8486</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=152577#p152577" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>migomigo пишет:</cite><blockquote><p>Что обозначает этот блок?</p></blockquote></div><p>Загляните в справку, что означает третий параметр в RegExReplace, там всё чётко объясняется. Или я не совсем понял, в чём именно вопрос, поясните.<br /></p><div class="quotebox"><cite>migomigo пишет:</cite><blockquote><p>s)<strong>.*?(</strong> - это что угодно перед <strong>&quot;https&quot;</strong>  ??</p></blockquote></div><p>Ну да. Точнее, скобка уже к «что угодно» не относится, скобками выделяются <a href="https://www.autohotkey.com/docs/misc/RegEx-QuickRef.htm#subpat">сабпаттерны</a>.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-03-14T22:03:08Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=152577#p152577</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=152576#p152576" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong></p><p>Они оба работают. Это шикарные шаблоны! Браво! <br />спустя какое-то время, дам ответ какой оказался более подходящим. Надо протестировать...</p><p>Большое человеческое спасибо!&nbsp; <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p><p>Можно попросить поверхностную расшифровку?</p><div class="codebox"><pre><code>&quot;s).*?(https?://.*?(?=\s|$)).*?(?=(?1)|$)&quot;</code></pre></div><p><strong>s).*?(</strong> - это что угодно перед <strong>&quot;https&quot;</strong>&nbsp; ??</p><p>Что обозначает этот блок? <br /></p><div class="codebox"><pre><code>&quot;$1`r`n&quot;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[migomigo]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24684</uri>
			</author>
			<updated>2022-03-14T20:47:46Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=152576#p152576</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=152575#p152575" />
			<content type="html"><![CDATA[<p>Попробуйте так:<br /></p><div class="codebox"><pre><code>NewStr = 
(
1.?&lt;h&gt;https://www.google.com
2.??https://www.autohotkey.com

;l&lt;Олень&gt;&lt;wekrhttps://learn.javascript.ru/regexp-multiline-mode

)

MsgBox, % RegExReplace(NewStr, &quot;s).*?(https?://.*?(?=\s|$)).*?(?=(?1)|$)&quot;, &quot;$1`r`n&quot;)
; или
MsgBox, % RegExReplace(NewStr, &quot;s).*?(https?://[^\s&quot;&quot;&lt;&gt;]+).*?(?=(?1)|$)&quot;, &quot;$1`r`n&quot;)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-03-14T18:48:52Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=152575#p152575</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=152574#p152574" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> Рад приветствовать! Ваш вклад в развитие форума, трудно переоценить. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p><br /><div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Решение зависит от того, что считать окончанием ссылки — конец строки, или что-то ещё?</p></blockquote></div><p>Хм. Я боялся этого вопроса.</p><p>Исходя из моего весьма скромного уровня осознанности, я думаю что простейшим вариантом есть следующее.<br />Окончанием <strong>URL</strong> можно считать:<br /> 	<strong>первый пробел</strong> || <strong>окончание строки</strong></p>]]></content>
			<author>
				<name><![CDATA[migomigo]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24684</uri>
			</author>
			<updated>2022-03-14T16:51:09Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=152574#p152574</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=152573#p152573" />
			<content type="html"><![CDATA[<p>Решение зависит от того, что считать окончанием ссылки — конец строки, или что-то ещё?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-03-14T16:30:20Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=152573#p152573</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=152572#p152572" />
			<content type="html"><![CDATA[<p>Всем желаю доброго времени суток!<br />Подскажите пожалуйста, можно ли ниже приведенный код, упростить | сократить | оптимизировать| усовершенствовать ?<br /></p><div class="codebox"><pre><code>
NewStr = 
(
1.?&lt;h&gt;https://www.google.com
2.??https://www.autohotkey.com

;l&lt;Олень&gt;&lt;wekrhttps://learn.javascript.ru/regexp-multiline-mode

)

value := deleteDebris(NewStr)

MsgBox, % value

ExitApp

deleteDebris(strigInput)
{
    Loop, parse, strigInput, `n, `r
    {
        if (A_LoopField = null)
            continue
        newString .= &quot;http&quot; RegExReplace(A_LoopField, &quot;(.*)(http)&quot;) &quot;`n&quot;
    }
    return newString
}
</code></pre></div><p>Задача кода: <br />1) Удалять всё, кроме ссылок на интернет страницы.<br />2) Оставить только чистую ссылку.</p>]]></content>
			<author>
				<name><![CDATA[migomigo]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24684</uri>
			</author>
			<updated>2022-03-14T16:04:37Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=152572#p152572</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=150071#p150071" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> как всегда все работает! <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br />Спасибо огромное!</p>]]></content>
			<author>
				<name><![CDATA[BlackCat]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=41382</uri>
			</author>
			<updated>2021-10-14T14:36:05Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=150071#p150071</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=150070#p150070" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>text =
( %
C:\Program Files\xxxx
&quot;C:\Program Files\xxxx&quot;
%ProgramFiles%\xxxx
&quot;%ProgramFiles%\xxxx&quot;
)
MsgBox, % RegExReplace(text, &quot;`am)^.+?Program ?Files%?([^&quot;&quot;]*)&quot;&quot;?$&quot;, A_ProgramFiles . &quot;$1&quot;)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-10-14T14:32:08Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=150070#p150070</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=150069#p150069" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> у меня очередной вопрос для понимания RegEx, если еще не надоел <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br />Допустим, теперь необходимо удалить из текста &quot; &quot; ... лучше на примере кода, чтобы было понятно.</p><p>Этот код:</p><div class="codebox"><pre><code>
text =
( %
C:\Program Files\xxxx
&quot;C:\Program Files\xxxx&quot;
%ProgramFiles%\xxxx
&quot;%ProgramFiles%\xxxx&quot;
)

MsgBox % RegExReplace(text, &quot;`ami)^.*%?Program\s?Files%?(\V*)\x22&quot;, A_ProgramFiles &quot;$1&quot;)
</code></pre></div><p>выдает такой выхлоп на MsgBox:<br /></p><div class="codebox"><pre><code>
C:\Program Files\xxxx
C:\Program Files\xxxx
%ProgramFiles%\xxxx
C:\Program Files\xxxx
</code></pre></div><p>Нужно во всех случах, не изменяя path, избавиться от &quot; &quot; и трансформировать переменную винды %ProgramFiles% в вид C:\Program Files<br />Что делаю не так???</p><p>Пробовал варианты с \x22? и прочие другие - ничего не получается.<br />Короче SOS - хочу понять!</p>]]></content>
			<author>
				<name><![CDATA[BlackCat]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=41382</uri>
			</author>
			<updated>2021-10-14T13:25:51Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=150069#p150069</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=150055#p150055" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> Спасибо за ценную инфу!<br />Буду изучать ...</p>]]></content>
			<author>
				<name><![CDATA[BlackCat]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=41382</uri>
			</author>
			<updated>2021-10-13T14:34:21Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=150055#p150055</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=150053#p150053" />
			<content type="html"><![CDATA[<p>Вся информация о варианте RegEx, который используется в AHK, <a href="http://www.pcre.org/pcre.txt">здесь</a>.<br />\v — любой символ из вертикальных пробелов, то-есть `n или `r.<br />\V — любой символ, не являющийся вертикальным пробелом.<br />\h и \H — то же самое с горизонтальными пробелами.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-10-13T13:16:51Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=150053#p150053</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=150050#p150050" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> весьма извиняюсь за беспокойство, но не смог найти инфу про хитрую \V* в конце шаблона. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br />Пробовал сделать так (.*) - это тоже работает.<br />Что означает \V и где про нее почитать ???<br />В справке ничего не нашел ....</p>]]></content>
			<author>
				<name><![CDATA[BlackCat]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=41382</uri>
			</author>
			<updated>2021-10-13T10:19:54Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=150050#p150050</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=150038#p150038" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> БОЛЬШОЕ БЛАГОДАРЮ!<br />Все заработало! <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br />Теперь буду копать, что означает этот код ... пока только пытаюсь въехать в RegEx</p>]]></content>
			<author>
				<name><![CDATA[BlackCat]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=41382</uri>
			</author>
			<updated>2021-10-12T13:04:50Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=150038#p150038</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=150037#p150037" />
			<content type="html"><![CDATA[<p>Если C:\Windows всегда начинается с C:, то можно заменить [a-z] на C.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-10-12T13:02:36Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=150037#p150037</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по RegExp [, RegEx, RegExMatch, RegExReplace]]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=150035#p150035" />
			<content type="html"><![CDATA[<p>А, да, мой косяк. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br /></p><div class="codebox"><pre><code>#NoEnv
text =
( %
C:\Windows\xxxx
%SystemRoot%\xxxx
%WinDir%\xxxx
)
MsgBox, % RegExReplace(text, &quot;`ami)^([a-z]:\\Windows|%SystemRoot%|%WinDir%)(\V*)&quot;, &quot;&quot;&quot;&quot; . A_WinDir . &quot;$2&quot;&quot;&quot;)</code></pre></div><p>Но если текст считывается с файла, такого не должно произойти.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-10-12T13:00:20Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=150035#p150035</id>
		</entry>
</feed>
