<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; Регулярные выражения в VBA]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=8570</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=8570&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «Регулярные выражения в VBA».]]></description>
		<lastBuildDate>Wed, 14 Aug 2013 11:19:52 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Регулярные выражения в VBA]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=74513#p74513</link>
			<description><![CDATA[<p><strong>Rumata</strong>, наконец, дошло, что «нет» относилось к первой цитате <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" />. Спасибо, ясно.</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Wed, 14 Aug 2013 11:19:52 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=74513#p74513</guid>
		</item>
		<item>
			<title><![CDATA[Re: Регулярные выражения в VBA]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=74510#p74510</link>
			<description><![CDATA[<p><strong>alexii</strong>, подразумевалось<br /></p><div class="quotebox"><cite>alexii пишет:</cite><blockquote><p>... их вовсе нет в VBA....</p></blockquote></div><div class="quotebox"><cite>Rumata пишет:</cite><blockquote><p>Вот именно - нет!</p></blockquote></div>]]></description>
			<author><![CDATA[null@example.com (Rumata)]]></author>
			<pubDate>Wed, 14 Aug 2013 10:44:04 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=74510#p74510</guid>
		</item>
		<item>
			<title><![CDATA[Re: Регулярные выражения в VBA]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=74509#p74509</link>
			<description><![CDATA[<p><strong>Rumata</strong>, почему нет? Библиотека используется одна и та же.</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Wed, 14 Aug 2013 10:35:46 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=74509#p74509</guid>
		</item>
		<item>
			<title><![CDATA[Re: Регулярные выражения в VBA]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=74503#p74503</link>
			<description><![CDATA[<div class="quotebox"><cite>alexii пишет:</cite><blockquote><p>Точнее сказать — их вовсе нет в VBA.</p></blockquote></div><div class="quotebox"><cite>alexii пишет:</cite><blockquote><p>Это ж те же самые регулярные выражения, что и в WSH</p></blockquote></div><p>Вот именно - нет! Но использовать все-таки можно, к счастью без сложных костылей.</p>]]></description>
			<author><![CDATA[null@example.com (Rumata)]]></author>
			<pubDate>Wed, 14 Aug 2013 06:09:12 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=74503#p74503</guid>
		</item>
		<item>
			<title><![CDATA[Re: Регулярные выражения в VBA]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=74501#p74501</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>Оказывается, по умолчанию регулярные выражения в VBA выключены.</p></blockquote></div><p>Точнее сказать — их вовсе нет в VBA.</p><div class="quotebox"><blockquote><p>Источников информации не даю, так как вся информация из разрозненных источников, найденных по запросу vba excel регулярные выражения.</p></blockquote></div><p>Это ж те же самые регулярные выражения, что и в WSH, и вся справка от WSH по регулярным выражениям полностью гожа (за исключением использования оператора VBA «Like»).</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Wed, 14 Aug 2013 04:59:46 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=74501#p74501</guid>
		</item>
		<item>
			<title><![CDATA[Регулярные выражения в VBA]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=74497#p74497</link>
			<description><![CDATA[<p>Недавно товарищ попросил поправить ссылки в excel файле. Часть работы была нетривиальна и требовала задействовать аппарат регулярных выражений. Оказывается, по умолчанию регулярные выражения в VBA выключены. Есть несколько решений. </p><p>1. Чтобы задействовать, их надо включить - Tools -&gt; References -&gt; Microsoft VBScript Regular Expressions 5.5. После этого они становятся доступны<br /></p><div class="codebox"><pre><code>
Dim str
str = &quot;1.2.3.4&quot;

Dim re, matches
Set re = New RegExp
re.Pattern = &quot;(\d+\.){3}\d+&quot;
Set matches = re.Execute(str)

If matches.Count &gt; 0 Then
    MsgBox &quot;IP address&quot;
End If
</code></pre></div><p>2. Можно создать объект <br /></p><div class="codebox"><pre><code>
Dim str
str = &quot;1.2.3.4&quot;

Dim re, matches
Set re = CreateObject(&quot;VBScript.RegExp&quot;)
re.Pattern = &quot;(\d+\.){3}\d+&quot;
Set matches = re.Execute(str)

If matches.Count &gt; 0 Then
    MsgBox &quot;IP address&quot;
End If
</code></pre></div><p>3. Если не требуются сложные преобразования, можно воспользоваться интересным оператором Like<br /></p><div class="codebox"><pre><code>
Dim str
str = &quot;1.2.3.4&quot;

If str Like &quot;#.#.#.#&quot; Then
    MsgBox &quot;IP address&quot;
End If
</code></pre></div><p>Здесь используются следующие шаблоны<br /></p><div class="codebox"><pre><code>
? Любой одиночный символ
* Ноль или более символов
# Любая одиночная цифра (0–9).
[charlist] Любой одиночный символ в классе символов (списке)
[!charlist] Любой одиночный символ не принадлежащий классу символов
</code></pre></div><p>4. Я намеренно не рассматриваю встроенные табличные функции SEARCH/SUBSTITUTE/REPLACE, потому что они работают с подстроками фиксированной длины. </p><p>Источников информации не даю, так как вся информация из разрозненных источников, найденных по запросу <a href="https://www.google.ru/#bav=on.2,or.r_qf.&amp;fp=4a946e60d9d5446f&amp;newwindow=1&amp;psj=1&amp;q=vba+excel+%D1%80%D0%B5%D0%B3%D1%83%D0%BB%D1%8F%D1%80%D0%BD%D1%8B%D0%B5+%D0%B2%D1%8B%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D1%8F">vba excel регулярные выражения</a>.</p>]]></description>
			<author><![CDATA[null@example.com (Rumata)]]></author>
			<pubDate>Wed, 14 Aug 2013 02:25:17 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=74497#p74497</guid>
		</item>
	</channel>
</rss>
