<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; JS: Регулярные выражения]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=8482&amp;type=atom" />
	<updated>2015-06-11T14:00:32Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=8482</id>
		<entry>
			<title type="html"><![CDATA[Re: JS: Регулярные выражения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94440#p94440" />
			<content type="html"><![CDATA[<p>Ясно, помимо AHK ещё ряд языков дружат с PCRE. Но тут - увы и ах...</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2015-06-11T14:00:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94440#p94440</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS: Регулярные выражения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94436#p94436" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>YMP пишет:</cite><blockquote><p>С кириллицей есть давно известная проблема — её символы не считаются буквами.</p></blockquote></div><p>В формате PCRE эта проблема обходится. На AHK:<br /></p><div class="codebox"><pre><code>RegExMatch(&quot;Roman_Кириллица&quot;, &quot;(*UCP)\w+&quot;, match)
MsgBox, % match</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-06-11T13:31:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94436#p94436</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS: Регулярные выражения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94435#p94435" />
			<content type="html"><![CDATA[<p><strong>DnsIs</strong>, с Вашим кодом тоже не всё в порядке. Попробуйте:<br /></p><div class="codebox"><pre><code>s1 = &quot;bbbb#фффф#cccc#ffff#dddd#tttt#яяяя#eeee#ffff&quot;
&#039;s1 = &quot;bbbb#фффф#cccc#ffff#dddd#eeee#ffff&quot;
s2 = s1</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2015-06-11T13:21:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94435#p94435</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS: Регулярные выражения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94434#p94434" />
			<content type="html"><![CDATA[<p><strong>YMP</strong><br />Спасибо за разъяснение. Весьма печальная новость. Это ж за столько лет и не исправить...<br />Придётся, видимо, либо <a href="http://forum.script-coding.com/viewtopic.php?pid=94415#p94415">так</a> либо простым перебором в цикле. Эх...</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2015-06-11T11:38:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94434#p94434</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS: Регулярные выражения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94433#p94433" />
			<content type="html"><![CDATA[<p>С кириллицей есть давно известная проблема — её символы не считаются буквами. Поэтому и граница слова \b не работает, и словесный символ \w. Хотя игнорирование регистра вроде работает.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2015-06-11T11:23:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94433#p94433</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS: Регулярные выражения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94432#p94432" />
			<content type="html"><![CDATA[<p>Рано радовался насчёт решётки...<br /></p><div class="codebox"><pre><code>Str = &quot;ййййЖЖффффЖЖфффф&quot;
Str2 = &quot;ффффЖЖййййЖЖфффф&quot;
With New RegExp
  .Pattern = &quot;(?= *\b|ЖЖ)(&quot; &amp; Replace(Str2, &quot;ЖЖ&quot;, &quot;|&quot;) &amp; &quot;)(ЖЖ|$)&quot;
  .IgnoreCase = True : .Global = True
  Str = .Replace(Str, &quot;&quot;) : .Pattern = &quot;ЖЖ$&quot;
  MsgBox .Replace(&quot;ЖЖ&quot; &amp; Str, &quot;&quot;)
End With</code></pre></div><p>Не работает...</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2015-06-11T10:48:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94432#p94432</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS: Регулярные выражения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94419#p94419" />
			<content type="html"><![CDATA[<p>Ну, вот, казалось бы, нашёл выход...<br /></p><div class="codebox"><pre><code>Str = &quot;aaa# aaa#aaa# aaaa# bbb bbb#baaa#bbb#cbbbb#bbb#daaa&quot;
Str2 = &quot;bbb#aaa&quot;
With New RegExp
  .Pattern = &quot;(?=\x20*\b|#)(&quot; &amp; Replace(Str2, &quot;#&quot;, &quot;|&quot;) &amp; &quot;)(#|$)&quot;
  .IgnoreCase = True : .Global = True
  Str = .Replace(Str, &quot;&quot;) : .Pattern = &quot;#$&quot;
  MsgBox &quot;&quot;&quot;&quot; &amp; .Replace(Str, &quot;&quot;) &amp; &quot;&quot;&quot;&quot;
End With</code></pre></div><p>Да вот с кириллицей не работает. <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" /> Почему?</p><p><strong>Add:</strong> Выяснил. Это проблема именно комбинаций с решёткой.<br />Т.к. я её приводил лишь в качестве примера, меня это не особо пугает.<br />Спасибо участникам дискуссии. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2015-06-09T11:09:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94419#p94419</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS: Регулярные выражения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94418#p94418" />
			<content type="html"><![CDATA[<p>Нужно именно для вставок в vbs, но код на js для сравнения, возможно, сгодится.</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2015-06-09T05:47:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94418#p94418</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS: Регулярные выражения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94417#p94417" />
			<content type="html"><![CDATA[<p>Вам принципиально VBS?</p>]]></content>
			<author>
				<name><![CDATA[DnsIs]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26282</uri>
			</author>
			<updated>2015-06-09T05:31:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94417#p94417</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS: Регулярные выражения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94416#p94416" />
			<content type="html"><![CDATA[<p>Как раз и хотелось бы избежать множественных вызовов .replace.<br />Если брать на вооружение подстановку делителя, то и тут попытка уместить в одно выражение провалилась:<br /></p><div class="codebox"><pre><code>Str = &quot;aaaa#bbbb&quot;
Str2 = &quot;bbbb#aaaa&quot;
Sym = &quot;#&quot;
With New RegExp
  .Pattern = &quot;(&quot; &amp; Sym &amp; &quot;(&quot; &amp; Replace(Str2, Sym, &quot;|&quot;) &amp; &quot;)&quot; &amp; Sym &amp; &quot;)|&quot; &amp; Sym &amp; &quot;{2,}&quot;
  .IgnoreCase = True : .Global = True
   Result = .Replace(Sym &amp; Str &amp; Sym, &quot;#&quot;)
End With : MsgBox Left(Result, Len(Result) - 1)</code></pre></div><p>И в любом случае ситуация с ^ удручающая. Не работает ни с |, ни с ?. <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2015-06-09T04:55:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94416#p94416</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS: Регулярные выражения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94415#p94415" />
			<content type="html"><![CDATA[<p>А так:</p><div class="codebox"><pre><code>&#039; строка, в которой меняем и в ней же смотрим совпадения:
s1 = &quot;aaaa#bbbb#aaaa#cbbbbb#daaaa#eaaaa&quot;
s2 = &quot;aaaa#bbbb&quot;
sym = &quot;#&quot;  &#039; символ замены
s1 = sym &amp; s1 &amp; sym
With New RegExp
    .Pattern = sym &amp; Replace(s2, sym, sym &amp; &quot;|&quot; &amp; sym) &amp; sym
    .IgnoreCase = True : .Global = True
    s1 = .Replace(s1, sym)
    s1 = .Replace(s1, sym)
    .Pattern = &quot;^&quot; &amp; sym &amp; &quot;|&quot; &amp; sym &amp; &quot;$&quot;
    s1 = .Replace(s1, &quot;&quot;)
    MsgBox s1
End With</code></pre></div><p>Правда не красивый код.</p>]]></content>
			<author>
				<name><![CDATA[DnsIs]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26282</uri>
			</author>
			<updated>2015-06-09T03:49:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94415#p94415</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS: Регулярные выражения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94414#p94414" />
			<content type="html"><![CDATA[<p><strong>Rumata</strong></p><div class="codebox"><pre><code>var s = &quot; aaaa#bbbb aaaa# aaaa&quot;
var r = &quot;aaaa#bbbb&quot;</code></pre></div><p>На выходе bbbb вместо bbbb aaaa# aaaa. И если поменять местами r и s, то вообще ничего не заменится.</p><br /><p><strong>DnsIs</strong><br />Пардон. Хорошо. Другой вариант </p><div class="codebox"><pre><code>Str = &quot;aaaaa#bbbb#baaaa#cbbbbb#daaaa#eaaaa&quot;
Str2 = &quot;aaaa#bbbb&quot;</code></pre></div><p>вместо aaaaa#baaaa#cbbbbb#daaaa#eaaaa даёт abcbde.</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2015-06-08T23:54:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94414#p94414</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS: Регулярные выражения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94413#p94413" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Flasher пишет:</cite><blockquote><p>Берём</p><div class="codebox"><pre><code>Str = &quot;аааа#bbbb&quot;
Str2 = &quot;bbbb#aaaa&quot;</code></pre></div><p>Результат: аааа#<br />Меняем местами, результат: bbbbaaaa</p></blockquote></div><p>А вы напишите все символы на одном языке.</p>]]></content>
			<author>
				<name><![CDATA[DnsIs]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26282</uri>
			</author>
			<updated>2015-06-08T18:58:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94413#p94413</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS: Регулярные выражения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94412#p94412" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
var s = &#039;aaaa#bbbb#cccc#dddd#eeee#ffff&#039;;

var r = &#039;aaaa#4444#dddd&#039;;

var re = new RegExp(&#039;\\b(&#039; + r.replace(/#/g, &#039;|&#039;) + &#039;)(#|$)&#039;, &#039;g&#039;);
var t = s.replace(re, &#039;&#039;).replace(/#+$/, &#039;&#039;);
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Rumata]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24846</uri>
			</author>
			<updated>2015-06-08T18:44:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94412#p94412</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: JS: Регулярные выражения]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94411#p94411" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>DnsIs пишет:</cite><blockquote><p>Вот ваш метод:</p></blockquote></div><p>Берём</p><div class="codebox"><pre><code>Str = &quot;аааа#bbbb&quot;
Str2 = &quot;bbbb#aaaa&quot;</code></pre></div><p>Результат: аааа#<br />Меняем местами, результат: bbbbaaaa</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2015-06-08T17:45:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94411#p94411</id>
		</entry>
</feed>
