<?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>Brandon Smith</title>
	<atom:link href="http://www.bhsmith.com/beta/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bhsmith.com/beta</link>
	<description></description>
	<lastBuildDate>Sun, 22 Jan 2012 22:39:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Evaluating Regular Expressions in PHP</title>
		<link>http://www.bhsmith.com/beta/2012/01/22/evaluating-regular-expressions-in-php/</link>
		<comments>http://www.bhsmith.com/beta/2012/01/22/evaluating-regular-expressions-in-php/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 22:39:44 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.bhsmith.com/beta/?p=35</guid>
		<description><![CDATA[It goes without saying that there are obvious benefits to using server-side validation of forms.  From e-mail validation to username formatting, it's important to use regular expressions to make sure any data being passed is both secure and compatible with your SQL database.  It's also important to use server-side validation over client-side(ex. JavaScript) to prevent [...]]]></description>
			<content:encoded><![CDATA[<p>It goes without saying that there are obvious benefits to using server-side validation of forms.  From e-mail validation to username formatting, it's important to use regular expressions to make sure any data being passed is both secure and compatible with your SQL database.  It's also important to use server-side validation over client-side(ex. JavaScript) to prevent SQL injection or any other malicious behavior.</p>
<p>Below is a basic example of how to evaluate a regular expression using PHP.  IF you're somewhat familiar with the language, the code should be easy enough to follow.  Please feel free to use at your own discretion; remember once a field/string has been evaluated the options are endless when handling the results!</p>
<p>A live example of the following code can be found <a title="Regular Expression in PHP Example" href="http://bhsmith.com/PHP/regex.php" target="_blank">here</a>.</p>
<p>NOTE: Please forgive the formatting in the following snippet.  This is a current limitation of the blog and the majority of the whitespace is formatted incorrectly.</p>
<p>--------------------------</p>
<p><strong>&lt;?php</strong><br />
<em>#pull POST variable from form submission</em><br />
<em>$str</em> = <strong>$_POST</strong>['str'];</p>
<p><em>#define the function run the regular expression for the string value submitted</em><br />
<strong><em>function</em> parseString</strong>(<em>$x</em>){</p>
<p><em>   #define the regular expression and set as variable: will return 1 if true(validated) or null if</em><br />
<em>    #the requirements are not met</em></p>
<p><em></em>    <em>$evaluated</em> = <strong>eregi</strong>("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", <em>$x</em>);</p>
<p><em>    #echo the input string for the sake of seeing results</em><br />
<strong>  echo</strong> <em>$x</em>;</p>
<p><em>    #evaulate the regular expression and return a message if true or false</em><br />
<strong> if</strong> (<em>$evaluated</em>){<br />
<strong>echo</strong> " You've entered a valid e-mail address.";<br />
}<strong> else</strong> {<br />
<strong> echo</strong> " Please enter a valid e-mail address.";<br />
}<br />
}<br />
<strong>?&gt;</strong><br />
&lt;!DOCTYPE HTML&gt;<br />
&lt;body&gt;<br />
<strong>    &lt;?php</strong><br />
<em>    #execute the parseString function and pass the form-submitted variable</em><br />
<strong>    parseString</strong>(<em>$str</em>);<br />
<strong>?&gt;</strong><br />
&lt;br /&gt;<br />
<em>    &lt;!-- html for the form submitting the field/string under question --&gt;</em><br />
&lt;form method="POST" action="regex.php"&gt;<br />
&lt;input type="text" id="str" name="str" /&gt;&lt;br /&gt;<br />
&lt;input type="submit" value="submit" id="submit" /&gt;<br />
&lt;/form&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bhsmith.com/beta/2012/01/22/evaluating-regular-expressions-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Job @ Astonish Designs</title>
		<link>http://www.bhsmith.com/beta/2012/01/21/new-job-astonish-designs/</link>
		<comments>http://www.bhsmith.com/beta/2012/01/21/new-job-astonish-designs/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 22:26:37 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.bhsmith.com/beta/?p=26</guid>
		<description><![CDATA[I've recently begun my new job at Astonish Designs - feeling really lucky to work with such a great team on some incredible projects! Check out the website - www.astonishdesigns.com]]></description>
			<content:encoded><![CDATA[<p>I've recently begun my new job at <a href="http://www.astonishdesigns.com" title="Astonish Designs" target="_blank">Astonish Designs</a> - feeling really lucky to work with such a great team on some incredible projects!  Check out the website - www.astonishdesigns.com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bhsmith.com/beta/2012/01/21/new-job-astonish-designs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Welcome!</title>
		<link>http://www.bhsmith.com/beta/2012/01/21/welcome/</link>
		<comments>http://www.bhsmith.com/beta/2012/01/21/welcome/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 22:24:50 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.bhsmith.com/beta/?p=24</guid>
		<description><![CDATA[If you're reading this you've haphazardly stumbled upon my blog. I'm in the process of building the rest of the site, so feel free to occasionally check back from time to time as I get around to posting content. You can also use the links above and on the side to download my resume or [...]]]></description>
			<content:encoded><![CDATA[<p>If you're reading this you've haphazardly stumbled upon my blog.  I'm in the process of building the rest of the site, so feel free to occasionally check back from time to time as I get around to posting content.  You can also use the links above and on the side to download my resume or navigate to my various social media outlets.  Thanks for stopping by!</p>
<p>Brandon</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bhsmith.com/beta/2012/01/21/welcome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello, World!</title>
		<link>http://www.bhsmith.com/beta/2011/09/28/hello-world/</link>
		<comments>http://www.bhsmith.com/beta/2011/09/28/hello-world/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 23:05:20 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://www.bhsmith.com/beta/?p=17</guid>
		<description><![CDATA[Check 1, 2, 3 Check]]></description>
			<content:encoded><![CDATA[<p>Check 1, 2, 3 Check</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bhsmith.com/beta/2011/09/28/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

