<?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>22 idea street &#187; Regular Expression</title>
	<atom:link href="http://22ideastreet.com/blog/tag/regular-expression/feed/" rel="self" type="application/rss+xml" />
	<link>http://22ideastreet.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 30 Jan 2012 15:24:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Regular Expression Anchor Mnemonic</title>
		<link>http://22ideastreet.com/blog/2009/09/20/regular-expression-anchor-mnemonic/</link>
		<comments>http://22ideastreet.com/blog/2009/09/20/regular-expression-anchor-mnemonic/#comments</comments>
		<pubDate>Sun, 20 Sep 2009 13:51:02 +0000</pubDate>
		<dc:creator>Anthony Panozzo</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Mnemonic]]></category>
		<category><![CDATA[Regular Expression]]></category>

		<guid isPermaLink="false">http://22ideastreet.com/blog/?p=816</guid>
		<description><![CDATA[In most languages, regular expressions have symbols to indicate when the first part or last part must match the first or last part of the string or line. These are called anchors. Anchors are usually the caret (^) for matching the beginning of a string, and the dollar sign ($) for the end of the [...]<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2009/09/20/regular-expression-anchor-mnemonic/">Regular Expression Anchor Mnemonic</a></p>
]]></description>
			<content:encoded><![CDATA[<p>In most languages, regular expressions have symbols to indicate when the first part or last part must match the first or last part of the string or line.  These are called anchors.  Anchors are usually the caret (^) for matching the beginning of a string, and the dollar sign ($) for the end of the string.  Hence:</p>
<pre>
'abc' =~ /c$/     => true
'abc' =~ /a$/     => false
'abc' =~ /^a/     => true
'abc' =~ /^c/     => false
</pre>
<p>I can remember what the anchors are.  When I have trouble remembering which is which, I use the following mnemonic:</p>
<blockquote><p>
Regular expressions are perfect, like the Garden of Eden.<br />
Snakes end the Garden of Eden.
</p></blockquote>
<p>In this case, the dollar sign looks a lot more like a snake than the caret does, so it&#8217;s the ending anchor.  This might be corny, or perhaps not completely accurate to the original story or the true nature of regular expressions (hairy beasts that they are), but it&#8217;s served me pretty well.</p>
<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2009/09/20/regular-expression-anchor-mnemonic/">Regular Expression Anchor Mnemonic</a></p>
]]></content:encoded>
			<wfw:commentRss>http://22ideastreet.com/blog/2009/09/20/regular-expression-anchor-mnemonic/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

