<?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>Logic High Blog &#187; Tricks</title>
	<atom:link href="http://blog.logichigh.com/category/tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.logichigh.com</link>
	<description>Logic High Software Blog</description>
	<lastBuildDate>Sat, 25 Jun 2011 00:39:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Validating an e-mail address</title>
		<link>http://blog.logichigh.com/2010/09/02/validating-an-e-mail-address/</link>
		<comments>http://blog.logichigh.com/2010/09/02/validating-an-e-mail-address/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 00:29:33 +0000</pubDate>
		<dc:creator>BadPirate</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Tricks]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[email validation]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://blog.logichigh.com/?p=231</guid>
		<description><![CDATA[Question: How do I verify if a string of characters is a valid e-mail address? First, you can only be sure about the second half of the e-mail address (the domain), as (in order to protect the anonymity of their users) many e-mail servers don&#8217;t give immediate responses when checked to see if the first [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.logichigh.com%2F2010%2F09%2F02%2Fvalidating-an-e-mail-address%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.logichigh.com%2F2010%2F09%2F02%2Fvalidating-an-e-mail-address%2F&amp;source=badpirate&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Question:  How do I verify if a string of characters is a valid e-mail address?</p>
<p>First, you can only be sure about the second half of the e-mail address (the domain), as (in order to protect the anonymity of their users) many e-mail servers don&#8217;t give immediate responses when checked to see if the first part of the e-mail address is valid (although some will send a bounce notification at a later date, once an e-mail has been attempted).</p>
<p>Second, you can only TRULY verify if the domain address is accurate if the testing application has internet access.</p>
<p>So, without making a DNS call (or before), you can&#8217;t be absolutely sure that the user or the domain actually exists, and can never be sure if the user (and therefore the email) is an actual e-mail address.</p>
<p>But you can check to see if the format is valid using a regular expression.  And this is where things get REALLY tricky, as how restrictive you want to be in your filtering depends on you, and while there is a defined standard, simply adhering to that standard may exclude e-mail addresses that are in use.</p>
<p>It seems that the most common regular expression that is suggest on the web is the following:</p>
<pre name="code">
^[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$
</pre>
<p>This will cover ALMOST all e-mail address you will run into, and will exclude obnoxious e-mails like badpirate@gmail.com.nospam</p>
<p>However, it will exclude a few e-mail addresses that are in use (but are probably being excluded and having trouble in lots of places:</p>
<ul>
<li>kevin@yesthistldexists.museum &#8211; Yes .museum is a valid Top Level Domain</li>
<li>kevin@kevin@logichigh.com &#8211; Yes the current e-mail RFC doesn&#8217;t allow this type of e-mail address HOWEVER older RFC&#8217;s did, and so there may be some folks still using this format (and not being able to use this format in lots of other places)</li>
<li>??@??web.jp &#8211; International characters in domains and user names are already being normalized to ascii friendly code by browsers and e-mail clients, so they are being used regularly, however if you are checking before that normalization occurs, these sorts of e-mail addresses will get tossed</li>
</ul>
<p>Therefore, I&#8217;ve also written a super lax e-mail format checker that will catch all scenarios.  This reg ex would probably be best used if you plan on checking to see if the domain exists after checking to see if the format loosely matches SOME format that COULD be in use <img src='http://blog.logichigh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre name="code">
^.+@.+\.[A-Za-z]{2}[A-Za-z]*$
</pre>
<p>Finally, if you&#8217;d like to implement this in cocoa code:</p>
<pre name="code" class="c++">
BOOL NSStringIsValidEmail(NSString *checkString)
{
	NString *stricterFilterString = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
	NSString *laxString = @".+@.+\.[A-Za-z]{2}[A-Za-z]*";
	NSString *emailRegex = stricterFilter ? stricterFilterString : laxString;
	NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
	return [emailTest evaluateWithObject:checkString];
}
</pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.logichigh.com%2F2010%2F09%2F02%2Fvalidating-an-e-mail-address%2F&amp;title=Validating%20an%20e-mail%20address" id="wpa2a_2"><img src="http://blog.logichigh.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.logichigh.com/2010/09/02/validating-an-e-mail-address/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Change font size, style and color in WordPress posts</title>
		<link>http://blog.logichigh.com/2009/04/06/change-font-size-style-and-color-in-wordpress-posts/</link>
		<comments>http://blog.logichigh.com/2009/04/06/change-font-size-style-and-color-in-wordpress-posts/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 20:08:52 +0000</pubDate>
		<dc:creator>BadPirate</dc:creator>
				<category><![CDATA[Tricks]]></category>
		<category><![CDATA[animated emoticons]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[change color]]></category>
		<category><![CDATA[change font]]></category>
		<category><![CDATA[change style]]></category>
		<category><![CDATA[emoticons]]></category>
		<category><![CDATA[faq]]></category>
		<category><![CDATA[font style]]></category>
		<category><![CDATA[fonts]]></category>
		<category><![CDATA[g-mail]]></category>
		<category><![CDATA[trick]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://blog.logichigh.com/?p=146</guid>
		<description><![CDATA[Easily change your font styles, font colors, and add animated emoticons to your wordpress.com posts.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.logichigh.com%2F2009%2F04%2F06%2Fchange-font-size-style-and-color-in-wordpress-posts%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.logichigh.com%2F2009%2F04%2F06%2Fchange-font-size-style-and-color-in-wordpress-posts%2F&amp;source=badpirate&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I was looking around wordpress.com today because for SOME easy way to make posts with more entertaining fonts and styles.  Also, it needed to be easy enough for a end using client to use.  There was a short <a href="http://en.forums.wordpress.com/topic/how-to-change-letter-sizes-and-fonts-in-a-post?replies=15">discussion</a>, and a corresponding <a href="http://faq.wordpress.com/2006/06/12/can-i-change-my-font-font-size/">FAQ</a> on the wordpress.com website, but all the options they offered were expensive, difficult for non web programmers, or intermittent (Pasting from word only seemed to work sometimes, and requires you to use M$oft products).</p>
<p>I was thinking, wouldn&#8217;t it be nice if you could just use the editor in g-mail.  And as it turns out:</p>
<p><span style="font-family:comic sans ms,sans-serif;">That <span style="font-size:medium;">Works <span style="font-family:garamond,serif;"><span style="background-color:#ffff66;">Perfectly</span>. <img style="vertical-align:middle;margin:0 .2ex;" src="http://mail.google.com/mail/e/517" alt="" /></span></span></span></p>
<p>Right down to the emoticons.  It doesn&#8217;t have EVERY font available, but only the ones that tend to be safe for use in all browsers.  In order to use it, type your intitial wordpress post as an e-mail, then when you are finished, copy the whole thing, and paste it into a wordpress entry. Once you are done, you can use the wordpress.com editor to make any changes (like adding images) that you weren&#8217;t able to do in the g-mail editor.  WHOOPIE!</p>
<p>I hope this works for your problem as well as it worked for mine.  Happy blogging.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.logichigh.com/2009/04/06/change-font-size-style-and-color-in-wordpress-posts/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

