<?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>Internet Strategy Guide &#187; regex</title>
	<atom:link href="http://phpprotip.com/category/development/regex/feed/" rel="self" type="application/rss+xml" />
	<link>http://phpprotip.com</link>
	<description>Together we can defeat the internet</description>
	<lastBuildDate>Sat, 11 Feb 2012 01:39:47 +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>Using MySQL Workbench with MAMP</title>
		<link>http://phpprotip.com/2011/10/using-mysql-workbench-with-mamp/</link>
		<comments>http://phpprotip.com/2011/10/using-mysql-workbench-with-mamp/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 06:07:52 +0000</pubDate>
		<dc:creator>chance</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[regex]]></category>

		<guid isPermaLink="false">http://phpprotip.com/?p=527</guid>
		<description><![CDATA[Recently I've started working locally due to the PHPStorm IDE. In order to work locally, I invested in MAMP Pro to make use of their GUI interface for configuring vhosts. I also like to use MySQL Workbench for my database work, unfortunately these 2 items never seemed to work together for me before.]]></description>
			<content:encoded><![CDATA[<p>Recently I've started working locally due to the <a class=\"zem_slink\" title=\"PhpStorm\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5qZXRicmFpbnMuY29tL3BocHN0b3Jt" rel=\"homepage nofollow\">PHPStorm</a> <a class=\"zem_slink\" title=\"Integrated development environment\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9JbnRlZ3JhdGVkX2RldmVsb3BtZW50X2Vudmlyb25tZW50" rel=\"wikipedia nofollow\">IDE</a>. In order to work locally, I invested in <a class=\"zem_slink\" title=\"MAMP\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5tYW1wLmluZm8vZW4vaW5kZXgucGhw" rel=\"homepage nofollow\">MAMP</a> Pro to make use of their <a class=\"zem_slink\" title=\"Graphical user interface\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9HcmFwaGljYWxfdXNlcl9pbnRlcmZhY2U=" rel=\"wikipedia nofollow\">GUI</a> interface for configuring vhosts. I also like to use <a class=\"zem_slink\" title=\"MySQL Workbench\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3diLm15c3FsLmNvbS8=" rel=\"homepage nofollow\">MySQL Workbench</a> for my database work, unfortunately these 2 items never seemed to work together for me before. After a brief google search I was able to find out how to connect to MAMP's <a class=\"zem_slink\" title=\"MySQL\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5teXNxbC5jb20=" rel=\"homepage nofollow\">MySQL</a> install to do <a class=\"zem_slink\" title=\"SQL\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5pc28ub3JnL2lzby9jYXRhbG9ndWVfZGV0YWlsLmh0bT9jc251bWJlcj00NTQ5OA==" rel=\"homepage nofollow\">SQL</a> Development, which is by done by choosing the local socket connection method and using the value /Applications/MAMP/tmp/mysql/mysql.sock for the connection.</p>
<div><a title=\"MySQL Workbench MAMP Socket Connection Settings by chancegarcia, on Flickr\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5mbGlja3IuY29tL3Bob3Rvcy9jaGFuY2VnYXJjaWEvNjIxOTYwNzQxOC8="><img src="http://phpprotip.com/wp-content/uploads/2011/10/6219607418_984dde5d08_z.jpg" alt="MySQL Workbench MAMP Socket Connection Settings" width="640" height="170" /></a></div>
<div><a title=\"MySQL Workbench MAMP Connection Settings by chancegarcia, on Flickr\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5mbGlja3IuY29tL3Bob3Rvcy9jaGFuY2VnYXJjaWEvNjIxOTYwNzI5Ni8="><img src="http://phpprotip.com/wp-content/uploads/2011/10/6219607296_4b07a59460_z.jpg" alt="MySQL Workbench MAMP Connection Settings" width="640" height="562" /></a></div>
<p>After setting that up, I got to thinking, "I'm already using an IDE for code convenience and a GUI for <a class=\"zem_slink\" title=\"Internet Relay Chat\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9JbnRlcm5ldF9SZWxheV9DaGF0" rel=\"wikipedia nofollow\">vhost</a> convenience, I should set up Server Administration with MySQL Workbench too!" So after some googling, I found an article to help me <a href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NocmlzY2hhcmx0b24udXMvdGlwL3VzaW5nLW15c3FsLXdvcmtiZW5jaC1tYW1wLXBybw==">set up Server Administration with MAMP</a>. Unfortunately the article only got things partially working and has no way to comment on it to have it corrected. So I'm going to outline the steps. Also I just noticed that the images with the article are updated correctly but it's hard to cut and paste an image of something someone has done so I'll just give you the value pairs</p>
<ul>
<li>Configuration File: /Applications/MAMP/tmp/mysql/my.cnf</li>
<li>Start: /Applications/MAMP/bin/startMysql.sh -</li>
<li>Stop: /Applications/MAMP/bin/stopMysql.sh -</li>
<li>Check MySQL Status: ps -xa | <a class=\"zem_slink\" title=\"Grep\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9HcmVw" rel=\"wikipedia nofollow\">grep</a> "/Applications/MAMP/Library/bin/[m]ysqld"</li>
</ul>
<div>If the check status doesn't work, just do a</div>
<div>ps -xa | grep MAMP</div>
<div>and find the correct path to mysqld</div>
<div>And that's all you need to know.</div>
<div><a title=\"MySQL Workbench MAMP System Profile Settings Tab by chancegarcia, on Flickr\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5mbGlja3IuY29tL3Bob3Rvcy9jaGFuY2VnYXJjaWEvNjIxOTA4NTY4MS8="><img src="http://phpprotip.com/wp-content/uploads/2011/10/6219085681_cf951a37a6_z.jpg" alt="MySQL Workbench MAMP System Profile Settings Tab" width="640" height="569" /></a></div>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class=\"zemanta-pixie-a\" title=\"Enhanced by Zemanta\" href="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy56ZW1hbnRhLmNvbS8="><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_c.png?x-id=6e393991-1345-4618-a1a2-eca170090c2c" alt="Enhanced by Zemanta" /></a></div>
 <img src="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=527" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://phpprotip.com/2011/10/using-mysql-workbench-with-mamp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Use regex to find the source of an image</title>
		<link>http://phpprotip.com/2008/03/use-regex-to-find-the-source-of-an-image/</link>
		<comments>http://phpprotip.com/2008/03/use-regex-to-find-the-source-of-an-image/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 17:47:54 +0000</pubDate>
		<dc:creator>chance</dc:creator>
				<category><![CDATA[regex]]></category>
		<category><![CDATA[img]]></category>
		<category><![CDATA[src]]></category>

		<guid isPermaLink="false">http://magic.garciawebapps.com/?p=3</guid>
		<description><![CDATA[Recently, I needed to find the source of an image in a blob of text. Since the text was out of my control, the exact location of the tag was unknown. So to solve this problem, I buckled down and finally learned some regex. Regex has been my nemesis for years up until this point. [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I needed to find the source of an image in a blob of text. Since the text was out of my control, the exact location of the tag was unknown. So to solve this problem, I buckled down and finally learned some regex. Regex has been my nemesis for years up until this point. Below is the result.<br />
<code><br />
/src=[\"](.*?)[\"]/i<br />
</code></p>
<p><span style="text-decoration: line-through;">Looking at it now, I think it could be improved upon to be<br />
</span> <code><span style="text-decoration: line-through;"><br />
/\&lt;img.*?src\=[\"|\']?(.*?)[\"|\']?/i</span></code></p>
<p>[Edit: I'm dumb. the first one works. can't figure out how to make quotes optional. They really shouldn't be because your shit should be well-formed.]</p>
<p>Basically, my original expression looks for the first src property it finds and returns the text within. Looking back on it, this makes a few assumptions.</p>
<p>1) the first src property is within an image tag</p>
<p>2)  the property is surrounded in double quotes</p>
<p>The second one (redone just now and therefore untested), should be better. Namely because It doesn't make any assumptions.</p>
<p>Point is that I'm now learning regex and am excited. Plus wanted to put this somewhere on the web in case there's someone like me who needs this and doesn't understand regex quite yet. Maybe one day I'll come back and break it down into how and why it does what it does but as of now, I don't think I can put my understanding of regex into a form someone who isn't me would understand.</p>
 <img src="http://phpprotip.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=3" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://phpprotip.com/2008/03/use-regex-to-find-the-source-of-an-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

