<?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=14667&amp;type=atom" />
	<updated>2020-05-01T09:18:09Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=14667</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Нумерация в цикле]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=139263#p139263" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
fbody =
(
	&lt;h2&gt;La crisis &lt;/h2&gt;

		&lt;p&gt;de&amp;nbsp;Europa&lt;/p&gt;
	&lt;div class=&quot;entry&quot;&gt;
)
Pos = 1
 
while RegExMatch(fbody, &quot;iO)(&lt;(p|h\d+|li)&gt;.*?&lt;/.*?&gt;)&quot;, mm, Pos), Pos := mm.Pos + mm.Len
{
   n := Format(&quot;§{:010}§&quot;, a_index) 
   fbody := RegExReplace(fbody, mm[0], n . mm[0] . n,, 1, mm.Pos)
}
msgbox % fbody
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-05-01T09:18:09Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=139263#p139263</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Нумерация в цикле]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=139254#p139254" />
			<content type="html"><![CDATA[<p>То есть, хотелось бы определить, где конец строки.</p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2020-04-30T18:39:47Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=139254#p139254</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Нумерация в цикле]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=139250#p139250" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>fbody =
(
	&lt;h2&gt;La crisis &lt;/h2&gt;

		&lt;p&gt;de&amp;nbsp;Europa&lt;/p&gt;
	&lt;div class=&quot;entry&quot;&gt;
)
mm := &quot;&quot;, Pos = 1
while RegExMatch(fbody, &quot;iO)(&lt;p|&lt;h1|&lt;h2|&lt;h3|&lt;h4|&lt;h5|&lt;h6|&lt;li)\b&quot;, mm, mm ? mm.Pos + mm.Len + 14 : 1)
{
   n := Format(&quot;§{:010}§&quot;, a_index)
   fbody := RegExReplace(fbody, mm[0], n . mm[0],, 1, mm.Pos)
}
msgbox % fbody</code></pre></div><p>Куда следует добавить «n», чтобы строка обрамлялась одинаковым числом, с таким результатом? —<br /></p><div class="codebox"><pre><code>
	§0000000001§&lt;h2&gt;La crisis &lt;/h2&gt;§0000000001§

		§0000000002§&lt;p&gt;de&amp;nbsp;Europa&lt;/p&gt;§0000000002§
	&lt;div class=&quot;entry&quot;&gt;
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2020-04-30T17:05:45Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=139250#p139250</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Нумерация в цикле]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=139247#p139247" />
			<content type="html"><![CDATA[<p>Проще так, если я понял правильно:<br /></p><div class="codebox"><pre><code>html =
(
&lt;p&gt; &lt;img data-attachment-id=&quot;11522&quot; data-permalink=&quot;https://paginatransversal.wordpress.com/2017/06/26/tiene-el-cristianismo-un-futuro/cristianismo/&quot; data-orig-file=&quot;https://paginatransversal.files.wordpress.com/2017/06/cristianismo.jpg&quot; data-orig-size=&quot;1024,576&quot; data-comments-opened=&quot;1&quot; data-image-meta=&quot;{&amp;quot;aperture&amp;quot;:&amp;quot;0&amp;quot;,&amp;quot;credit&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;camera&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;caption&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;created_timestamp&amp;quot;:&amp;quot;0&amp;quot;,&amp;quot;copyright&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;focal_length&amp;quot;:&amp;quot;0&amp;quot;,&amp;quot;iso&amp;quot;:&amp;quot;0&amp;quot;,&amp;quot;shutter_speed&amp;quot;:&amp;quot;0&amp;quot;,&amp;quot;title&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;orientation&amp;quot;:&amp;quot;0&amp;quot;}&quot; data-image-title=&quot;CRISTIANISMO&quot; data-image-description=&quot;&quot; data-medium-file=&quot;https://paginatransversal.files.wordpress.com/2017/06/cristianismo.jpg?w=300&quot; data-large-file=&quot;https://paginatransversal.files.wordpress.com/2017/06/cristianismo.jpg?w=1024&quot; class=&quot; wp-image-11522 alignleft&quot; src=&quot;pic/2017=06=cristianismo.jpg_w=187_038_h=105.jpg&quot; alt=&quot;&quot; width=&quot;187&quot; height=&quot;105&quot; srcset=&quot;https://paginatransversal.files.wordpress.com/2017/06/cristianismo.jpg?w=187&amp;amp;h=105 187w, https://paginatransversal.files.wordpress.com/2017/06/cristianismo.jpg?w=374&amp;amp;h=210 374w, https://paginatransversal.files.wordpress.com/2017/06/cristianismo.jpg?w=150&amp;amp;h=84 150w, https://paginatransversal.files.wordpress.com/2017/06/cristianismo.jpg?w=300&amp;amp;h=169 300w&quot; sizes=&quot;(max-width: 187px) 100vw, 187px&quot; /&gt;por &lt;strong&gt;Vladimir Legoyda&lt;/strong&gt; &amp;#8211; ВїTiene el cristianismo un futuro? El pensador polaco del siglo XX Kolokovsky dijo una vez con mucha exactitud que la lucha contra el cristianismo no se lleva a cabo a travГ©s de la discusiГіn. El arma principal es un cacareo insensato. No los argumentos de los oponentes, no un sistema de pruebas, no las reflexiones filosГіficas&amp;#8230; sino una negaciГіn del diГЎlogo y una risa sin sentido.&lt;span id=&quot;more-11521&quot;&gt;&lt;/span&gt;&lt;/p&gt;
)

while RegExMatch(html, &quot;OU)(.*)(&lt;.+&gt;)&quot;, m, m ? m.Pos + m.Len : 1)
   newHtml .= m[1] . Format(&quot;[{:010}]&quot;, A_Index) . m[2]
MsgBox, % newHtml</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-04-30T08:23:02Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=139247#p139247</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Нумерация в цикле]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=139246#p139246" />
			<content type="html"><![CDATA[<p>Как я понял, это количество символов в строке из предыдущего задания, но замена на большее число не работала. Возможна ли работа без привязки к длине строки?</p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2020-04-30T06:56:28Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=139246#p139246</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Нумерация в цикле]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=139243#p139243" />
			<content type="html"><![CDATA[<p>А откуда число 14 взялось?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-04-29T23:27:52Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=139243#p139243</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Нумерация в цикле]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=139242#p139242" />
			<content type="html"><![CDATA[<p>По какой причине номер не проставляется перед всеми тегами, как это предполагается в рег. выражении? — <br /></p><div class="codebox"><pre><code>
html =
(
&lt;p&gt; &lt;img data-attachment-id=&quot;11522&quot; data-permalink=&quot;https://paginatransversal.wordpress.com/2017/06/26/tiene-el-cristianismo-un-futuro/cristianismo/&quot; data-orig-file=&quot;https://paginatransversal.files.wordpress.com/2017/06/cristianismo.jpg&quot; data-orig-size=&quot;1024,576&quot; data-comments-opened=&quot;1&quot; data-image-meta=&quot;{&amp;quot;aperture&amp;quot;:&amp;quot;0&amp;quot;,&amp;quot;credit&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;camera&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;caption&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;created_timestamp&amp;quot;:&amp;quot;0&amp;quot;,&amp;quot;copyright&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;focal_length&amp;quot;:&amp;quot;0&amp;quot;,&amp;quot;iso&amp;quot;:&amp;quot;0&amp;quot;,&amp;quot;shutter_speed&amp;quot;:&amp;quot;0&amp;quot;,&amp;quot;title&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;orientation&amp;quot;:&amp;quot;0&amp;quot;}&quot; data-image-title=&quot;CRISTIANISMO&quot; data-image-description=&quot;&quot; data-medium-file=&quot;https://paginatransversal.files.wordpress.com/2017/06/cristianismo.jpg?w=300&quot; data-large-file=&quot;https://paginatransversal.files.wordpress.com/2017/06/cristianismo.jpg?w=1024&quot; class=&quot; wp-image-11522 alignleft&quot; src=&quot;pic/2017=06=cristianismo.jpg_w=187_038_h=105.jpg&quot; alt=&quot;&quot; width=&quot;187&quot; height=&quot;105&quot; srcset=&quot;https://paginatransversal.files.wordpress.com/2017/06/cristianismo.jpg?w=187&amp;amp;h=105 187w, https://paginatransversal.files.wordpress.com/2017/06/cristianismo.jpg?w=374&amp;amp;h=210 374w, https://paginatransversal.files.wordpress.com/2017/06/cristianismo.jpg?w=150&amp;amp;h=84 150w, https://paginatransversal.files.wordpress.com/2017/06/cristianismo.jpg?w=300&amp;amp;h=169 300w&quot; sizes=&quot;(max-width: 187px) 100vw, 187px&quot; /&gt;por &lt;strong&gt;Vladimir Legoyda&lt;/strong&gt; &amp;#8211; ВїTiene el cristianismo un futuro? El pensador polaco del siglo XX Kolokovsky dijo una vez con mucha exactitud que la lucha contra el cristianismo no se lleva a cabo a travГ©s de la discusiГіn. El arma principal es un cacareo insensato. No los argumentos de los oponentes, no un sistema de pruebas, no las reflexiones filosГіficas&amp;#8230; sino una negaciГіn del diГЎlogo y una risa sin sentido.&lt;span id=&quot;more-11521&quot;&gt;&lt;/span&gt;&lt;/p&gt;
)

match := &quot;&quot;, Pos = 1
while RegExMatch(html, &quot;iO)&lt;[^&gt;]*&gt;&quot;, match, match ? match.Pos + match.Len + 14 : 1)
{
   n := Format(&quot;{:0&quot; . 10 . &quot;u}&quot;, a_index)
   html := RegExReplace(html, match[0], &quot;[&quot; . n . &quot;]&quot; . match[0],, 1, match.Pos)
}
msgbox % html</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2020-04-29T19:54:01Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=139242#p139242</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Нумерация в цикле]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=133105#p133105" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>str =
(
&lt;h1 class=&quot;&quot;&gt;
   &lt;h2 class=&quot;&quot;&gt;
      &lt;h3 class=&quot;&quot;&gt;
&lt;h2 id=&quot;1&quot;&gt;
&lt;h2 id=&quot;2&quot;&gt;
)
match := &quot;&quot;
while RegExMatch(str, &quot;iO)&lt;h\d+&quot;, match, match ? match.Pos + match.Len + 14 : 1)
   str := RegExReplace(str, match[0], &quot;&lt;a name=&quot;&quot;&quot; . A_Index . &quot;&quot;&quot;&gt;&lt;/a&gt;&quot; . match[0],, 1, match.Pos)
MsgBox % str </code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2019-03-24T17:32:54Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=133105#p133105</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Нумерация в цикле]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=133104#p133104" />
			<content type="html"><![CDATA[<p>А как сделать, чтобы нумерация не повторялась для одинаковых тегов?<br /></p><div class="codebox"><pre><code>str =
(
&lt;h1 class=&quot;&quot;&gt;
   &lt;h2 class=&quot;&quot;&gt;
      &lt;h3 class=&quot;&quot;&gt;
&lt;h2 id=&quot;1&quot;&gt;
&lt;h2 id=&quot;2&quot;&gt;
)
str := RegExReplace(str, &quot;i)&lt;h(\d+)[^&gt;]*&gt;&quot;, &quot;&lt;a name=&quot;&quot;$1&quot;&quot;&gt;&lt;/a&gt;$0&quot;)
MsgBox % str</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2019-03-24T16:59:42Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=133104#p133104</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Нумерация в цикле]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=133102#p133102" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>str =
(
&lt;h1 class=&quot;
   &lt;h2 class=&quot;
      &lt;h3 class=&quot;
)
MsgBox, % RegExReplace(str, &quot;&lt;h(\d+)\s+class=&quot;, &quot;&lt;a name=&quot;&quot;$1&quot;&quot;&gt;&lt;/a&gt;$0&quot;)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2019-03-24T16:35:00Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=133102#p133102</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Нумерация в цикле]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=133101#p133101" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>str =
(
&lt;h1 class=&quot;
	&lt;h2 class=&quot;
		&lt;h3 class=&quot;
)

RegexReplace(str, &quot;is)(&lt;h1|&lt;h2|&lt;h3|&lt;h4|&lt;h5)&quot;,, headersCount) ;определить колич заголовков
loop, %headersCount%
{
   str := RegExReplace(str, &quot;m`a)(&lt;h1|&lt;h2|&lt;h3|&lt;h4|&lt;h5)&quot;, &quot;&lt;a name=&quot;&quot;&quot; A_Index &quot;&quot;&quot;&gt;&lt;/a&gt;$1&quot;)
}
MsgBox % str</code></pre></div><p>Как произвести разовую обработку в каждой строке, с назначением возрастающей нумерации, чтобы получилось, как ниже? — <br /></p><div class="codebox"><pre><code>
&lt;a name=&quot;1&quot;&gt;&lt;/a&gt;&lt;h1 class=&quot;
	&lt;a name=&quot;2&quot;&gt;&lt;/a&gt;&lt;h2 class=&quot;
		&lt;a name=&quot;3&quot;&gt;&lt;/a&gt;&lt;h3 class=&quot;
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2019-03-24T16:25:04Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=133101#p133101</id>
		</entry>
</feed>
