<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PMA Media Group&#187; rubular</title>
	<atom:link href="http://www.pmamediagroup.com/tag/rubular/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pmamediagroup.com</link>
	<description>Unique Marketing Techniques and Strategies with Guaranteed Results!</description>
	<lastBuildDate>Fri, 27 Aug 2010 18:14:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Regular Expression Lookahead</title>
		<link>http://www.pmamediagroup.com/2009/06/regular-expression-lookahead/</link>
		<comments>http://www.pmamediagroup.com/2009/06/regular-expression-lookahead/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 23:11:16 +0000</pubDate>
		<dc:creator>Aaron Murphy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[lookahead]]></category>
		<category><![CDATA[regular expression]]></category>
		<category><![CDATA[rubular]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.pmamediagroup.com/?p=874</guid>
		<description><![CDATA[Using standard regular expressions is pretty easy for most tasks. However, there is one task that requires lookaheads. I am referring to using negative lookahead to check for strings that do not follow a desired match. The syntax is

(?!someregexp)

where &#8220;someregexp&#8221; is a regular expression to match. The negative lookahead will reverse the logic for you. [...]]]></description>
			<content:encoded><![CDATA[<p>Using standard regular expressions is pretty easy for most tasks. However, there is one task that requires lookaheads. I am referring to using negative lookahead to check for strings that do not follow a desired match. The syntax is</p>

<div class="wp_syntax"><div class="code"><pre class="regexp" style="font-family:monospace;">(?!someregexp)</pre></div></div>

<p>where &#8220;someregexp&#8221; is a regular expression to match. The negative lookahead will reverse the logic for you. <span id="more-874"></span>So when I needed to find all Master&#8217;s degree programs except Master of Science, I used something like</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">master<span style="color:#006600; font-weight:bold;">&#40;</span>?!\sof\sscience<span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p> to match say &#8220;master of arts&#8221; or &#8220;master&#8221; but not &#8220;master of science&#8221;.</p>
<p>The lookahead doesn&#8217;t move the position, so you can think of it as saving the spot it was in, checking forward, then returning. If you like regular expressions, you should experiment with lookaheads to get a feel for what they can do. I like to use <a href="http://www.rubular.com/">rublar</a>, a ruby regular expression editor and tester.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pmamediagroup.com/2009/06/regular-expression-lookahead/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/


Served from: www.pmamediagroup.com @ 2010-09-06 16:19:03 -->