<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Tom Andreas Mannerud</title>
	<atom:link href="http://mannerud.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://mannerud.org</link>
	<description>IT Professional, Educator, and Consultant</description>
	<pubDate>Wed, 01 Jul 2009 00:49:50 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Regular Expressions in VBScript</title>
		<link>http://mannerud.org/2008/11/regular-expressions-in-vbscript/</link>
		<comments>http://mannerud.org/2008/11/regular-expressions-in-vbscript/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 00:09:40 +0000</pubDate>
		<dc:creator>Tom Andreas Mannerud</dc:creator>
		
		<category><![CDATA[Scripts]]></category>

		<category><![CDATA[Regular Expressions]]></category>

		<category><![CDATA[Search Strings]]></category>

		<category><![CDATA[VBScript]]></category>

		<guid isPermaLink="false">http://mannerud.org/?p=27</guid>
		<description><![CDATA[Finding string patterns within a text, or Regular Expressions as the are called, can be easily accomplished in VBScript. Below is a sample code that illustrates how to find the pattern &#8220;-L&#8221; from a search string.
First we must declare our search string and create our Regular Expression Object.
strSearchString = &#8220;TPA-FWR-L001&#8243;
Set objRegExp = New RegExp
We then [...]]]></description>
			<content:encoded><![CDATA[<p>Finding string patterns within a text, or Regular Expressions as the are called, can be easily accomplished in VBScript. Below is a sample code that illustrates how to find the pattern &#8220;-L&#8221; from a search string.</p>
<p>First we must declare our search string and create our Regular Expression Object.</p>
<blockquote><p>strSearchString = &#8220;TPA-FWR-L001&#8243;<br />
<span style="color: #0000ff;">Set</span> objRegExp = <span style="color: #0000ff;">New RegExp</span></p></blockquote>
<p><span style="color: #000000;">We then need to tell the object how to behave and what to look for. For example in our case we want to search for the pattern &#8220;-L&#8221; from within our search string. We have chosen to ignore case, so it will return a positive result for both upper and lower case. Lastly, we only want to return a positive result at the first occurance. By changing the global property to True it will return all instances.</span></p>
<blockquote><p><span style="color: #0000ff;">With</span> objRegExp<br />
.Pattern = &#8220;-L&#8221;<br />
.IgnoreCase = <span style="color: #0000ff;">True</span><br />
.Global = <span style="color: #0000ff;">False</span><br />
<span style="color: #0000ff;">End With</span></p></blockquote>
<p><span style="color: #000000;">We then want to execute our search and return the result into ExpMatch</span></p>
<blockquote><p><span style="color: #0000ff;">Set</span> ExpMatch = objRegExp.Execute(strSearchString)</p></blockquote>
<p><span style="color: #0000ff;"><span style="color: #000000;">And lastly, we verify if a match is found and return the result for each match.</span> </span></p>
<blockquote><p><span style="color: #0000ff;">If</span> ExpMatch.Count &gt; 0 <span style="color: #0000ff;">Then</span><br />
<span style="color: #0000ff;">For Each</span> Matched <span style="color: #0000ff;">in</span> ExpMatch<br />
<span style="color: #008000;">&#8216;Code to execute for each match goes here</span><br />
<span style="color: #0000ff;">MsgBox</span> &#8220;Expression &#8221; &amp; objRegExp.Pattern &amp; &#8221; was found&#8221;<br />
<span style="color: #0000ff;">Next</span><span style="color: #0000ff;"><br />
</span><span style="color: #0000ff;">End If</span></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://mannerud.org/2008/11/regular-expressions-in-vbscript/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
