<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 22 May 2013 06:56:12 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Refulz.com: Special characters in Regular Expressions - Part 1]]></title>
      <guid>http://www.phpdeveloper.org/news/18080</guid>
      <link>http://www.phpdeveloper.org/news/18080</link>
      <description><![CDATA[<p>
On the Refulz.com site they've posted the <a href="http://php.refulz.com/special-characters-in-regular-expressions-part-1/">first part of a series</a> about the basics of using special characters regular expressions (both in PHP and outside of it).
</p>
<blockquote>
With this post, we continue to explore the Regular expressions. The first post of the <a href="http://php.refulz.com/series/learning-regular-expressions/">Learning Regular Expression series</a> introduced Regular Expressions. The first post covers the regular expression delimiters and the "i" pattern modifier. In the language of regular expression, there is a special meaning of certain characters.
</blockquote>
<p>
In this article they show the use of characters like the caret, asterisk, dot and dollar symbol to modify your expressions to handle special cases, matching for more than one character and the start and end of strings.
</p>]]></description>
      <pubDate>Tue, 12 Jun 2012 08:39:11 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Michael Nitschinger's Blog: Writing a simple lexer in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17942</guid>
      <link>http://www.phpdeveloper.org/news/17942</link>
      <description><![CDATA[<p>
In <a href="http://nitschinger.at/Writing-a-simple-lexer-in-PHP">this new post</a> to his blog <i>Michael Nitschinger</i> shows you how to create a simple <a href="http://en.wikipedia.org/wiki/Lexical_analysis">lexer</a> to parse incoming content (like custom configuration files or anything that uses its own domain-specific language).
</p>
<blockquote>
A lot of developers avoid writing parsers because they think it's pretty hard to do so. Writing an efficient parser for a general purpose language (like PHP, Ruby, Java,...) is hard, but fortunately, most of the time we don't need that much complexity. Typically we just want to parse input coming from config files or from a specific problem domain (expressed through DSLs). DSLs (Domain Specific Languages) are pretty cool, because they allow you to express logic and flow in a very specific and convenient way for a limited set of tasks.
</blockquote>
<p>
He illustrates with an example based on the <a href="http://lithify.me/">Lithium</a> framework's routing engine and how it could parse a text file that relates a route to a controller/action combination. He creates a "Lexer" class that defines a few regular expressions to parse the incoming text strings for matches on things like whitespace, URLs and identifiers (words) and return each in the lexer's output. 
</p>]]></description>
      <pubDate>Thu, 10 May 2012 12:57:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPCodeBase.com: PHP Magic Function : glob()]]></title>
      <guid>http://www.phpdeveloper.org/news/16134</guid>
      <link>http://www.phpdeveloper.org/news/16134</link>
      <description><![CDATA[<p>
On PHPCodeBase.com there's a recent post looking at <a href="http://www.phpcodebase.com/php-magic-function-glob/">a handy file system function</a> that you can use to search directories simpler than a usual opendir/readdir method - <a href="http://php.net/glob">glob</a>.
</p>
<blockquote>
Are you guys still using <a href="http://php.net/manual/en/function.opendir.php">opendir()</a> function to read the the files from the folder in PHP? Luckily PHP have the <a href="http://php.net/manual/en/function.glob.php">glob()</a> function which perform this task very faster and smarter.
</blockquote>
<p>
He compares an example of the opendir/readdir method to a few line replacement with glob, both searching the same directory for files. He looks at the arguments you can pass into glob - the path to search and a flag that adds special handling to the method (like turning off sorting, modifying the regular expression handling and stopping on errors).
</p>]]></description>
      <pubDate>Fri, 01 Apr 2011 08:21:20 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[SitePoint PHP Blog: How to Tidy Your WordPress Menu HTML]]></title>
      <guid>http://www.phpdeveloper.org/news/15808</guid>
      <link>http://www.phpdeveloper.org/news/15808</link>
      <description><![CDATA[<p>
On the SitePoint PHP blog today there's a new post from <i>Craig Buckler</i> for the WordPress users out there. The HTML that this popular blog/CMS tools spits out can sometimes be not-so-semantic. <i>Craig</i> <a href="http://blogs.sitepoint.com/2011/01/26/wordpress-menu-html-tidy/">shares a tip</a> on cleaning up one aspect of it - the methods returning lists for menus or sitemaps.
</p>
<blockquote>
love WordPress. I also love clean semantic HTML. Unfortunately, several of the standard WordPress theme functions return code that is a little untidy. For me, the primary culprits are <a href="http://codex.wordpress.org/Function_Reference/wp_list_pages">wp_list_pages()</a> and the newer <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu">wp_nav_menu()</a>; both return an unordered list of page links.
</blockquote>
<p>
He gives an example of a sample list generated by wp_nav_menu() that's full of badly formatted and unnecessary elements. To help fix the issue, he shares his regular expression-based call to strip out things like extra tabs, empty classes and all title attributes. Obviously you can customize this as you need, but it's a good start towards something that's a bit cleaner and up to code.
</p>]]></description>
      <pubDate>Wed, 26 Jan 2011 09:37:59 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: 10 Easy Examples for Deciphering PHP Regular Expressions]]></title>
      <guid>http://www.phpdeveloper.org/news/14828</guid>
      <link>http://www.phpdeveloper.org/news/14828</link>
      <description><![CDATA[<p>
On PHPBuilder.com today <i>Jason Gilmore</i> has posted <a href="http://www.phpbuilder.com/columns/Regular-Expressions/Jason_Gilmore072010.php3">ten easy regular expression tips</a> that can help you understand the matching on some of the common pieces of data your app might come across.
</p>
<blockquote>
Regular expressions are the PHP programmer's equivalent of being audited by the IRS. The mere thought of an encounter is enough to cause heart palpitations. [...] If you would like to decipher the melange of backslashes, brackets, asterisks and other characters somehow capable of rooting out everything from email addresses to HTML tags, follow along with this tutorial which introduces the topic using 10 numerically-oriented examples.
</blockquote>
<p>
He starts simple - finding digits - and progresses into matching groups, filtering strings, using more complex patterns, correcting errors you might find in the data and a note that, despite their power, you don't always need them. There could be a simpler way.
</p>]]></description>
      <pubDate>Wed, 21 Jul 2010 11:26:03 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Stoimen Popov's Blog: preg_match Give Names to the Matches]]></title>
      <guid>http://www.phpdeveloper.org/news/14750</guid>
      <link>http://www.phpdeveloper.org/news/14750</link>
      <description><![CDATA[<p>
In <a href="http://www.stoimen.com/blog/2010/07/03/php-preg_match-give-names-to-the-matches/">a quick post</a> to hos blog today <i>Stoimen Popov</i> points out a handy feature of the <a href="http://php.net/preg_match">preg_match</a> function in PHP (in PHP 5.2.2 and higher) to be able to name the results of the regular expression match.
</p>
<blockquote>
In PHP 5.2.2+ you can name the sub patterns returned from preg_match  with a specific syntax. [...] This is extremely helpful, when dealing with long patterns. [...] Although it may look difficult to maintain, now you can simply name the sub patterns of preg_match and to call them with their associative array keys. This is more clear when writing code and it's definitely more maintainable.
</blockquote>
<p>
The key is to use a special syntax as a part of the expression's pattern. This replaces the numeric keys of the matches with values you define, making it simpler to use the results (instead of having to work with numbers that don't match much of anything). Code and expression examples are included.
</p>]]></description>
      <pubDate>Tue, 06 Jul 2010 11:01:48 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[NETTUTS.com: Advanced Regular Expression Tips and Techniques]]></title>
      <guid>http://www.phpdeveloper.org/news/14369</guid>
      <link>http://www.phpdeveloper.org/news/14369</link>
      <description><![CDATA[<p>
NETTUTS.com has posted an <a href="http://net.tutsplus.com/tutorials/php/advanced-regular-expression-tips-and-techniques/">advanced guide to regular expressions</a> that just happens to use the PHP <a href="http://us.php.net/manual/en/ref.pcre.php">PCRE functions</a> to do the matching.
</p>
<blockquote>
Regular Expressions are the Swiss Army knife for searching through information for certain patterns. They have a wide arsenal of tools, some of which often go undiscovered or underutilized. Today I will show you some advanced tips for working with regular expressions.
</blockquote>
<p>They have it broken out into several tips including:</p>
<ul>
<li>Using Callbacks
<li>Lookahead and Lookbehind Assertions
<li>Filtering Patterns
<li>Named Subpatterns
</ul>
<p>
There's also a section called "Don't Reinvent the Wheel" with a few handy expressions to do common things like parse [X]HTML and validating form input.
</p>]]></description>
      <pubDate>Mon, 19 Apr 2010 09:47:04 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Padraic Brady's Blog: PCRE Regex Word Matching: "w" vs "a-zA-Z0-9_"]]></title>
      <guid>http://www.phpdeveloper.org/news/13732</guid>
      <link>http://www.phpdeveloper.org/news/13732</link>
      <description><![CDATA[<p>
<i>Padraic Brady</i> has <a href="http://blog.astrumfutura.com/archives/430-PCRE-Regex-Word-Matching-w-vs-a-zA-Z0-9_.html">posted about</a> an issue he noticed when working with regular expressions and the "word" character type to find something that's alpha-numeric (including an underscore):
</p>
<blockquote>
You can find the "word" generic character type used in a lot of PHP code including the Zend Framework. The problem is that the assumption above is incorrect. Now, most of the time these act identically because PHP is compiled using its own packaged PCRE library. However, I've seen more than once systems where this is not the case. Usually in some non-English capacity where additional locale support was considered necessary or standard practice.
</blockquote>
<p>
The problem comes when PHP is compiled against a custom PCRE library, making it more locale-aware. He gives instructions on how to get this to a testable state on your environment (using an <a href="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.00.tar.gz">updated PREC library</a>) and get it working for characters in French, like the accented "a" or "e".
</p>]]></description>
      <pubDate>Mon, 28 Dec 2009 09:41:21 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Jordi Boggiano's Blog: Major glob() fail]]></title>
      <guid>http://www.phpdeveloper.org/news/13633</guid>
      <link>http://www.phpdeveloper.org/news/13633</link>
      <description><![CDATA[<p>
<i>Jordi Boggiano</i> <a href="http://seld.be/notes/major-glob-fail">had the "pleasure"</a> of discovering a small quirk with PHP's <a href="http://php.net/glob">glob</a> function in an application he was working on - watch out for directories that contain square braces, they won't return in the results!
</p>
<blockquote>
Working on some personal project that lists a bunch of stuff on my hard drive, I found out that directories that contain square brackets (those []) don't return any results for the simple reason that glob reads [stuff] as a character class, just like in regular expressions. When you know it it makes perfect sense, but when you don't, the documentation is really not so helpful. Of course it mentions libc's glob() and unix shells, but not everyone knows what that implies at first glance.
</blockquote>
<p>
He tried a few things to get around the bug (including escaping the brackets in the directories) but ended up writing a function (glob_quote) to handle the escaping of all of the meta-characters glob might need to escape to return all of the files and folders correctly.
</p>]]></description>
      <pubDate>Mon, 07 Dec 2009 13:50:54 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPFreaks.com: PCRE Regex Spotlight: K]]></title>
      <guid>http://www.phpdeveloper.org/news/13104</guid>
      <link>http://www.phpdeveloper.org/news/13104</link>
      <description><![CDATA[<p>
On the PHPFreaks.com blog today there's <a href="http://www.phpfreaks.com/blog/pcre-regex-spotlight-k">a quick new post</a> looking at one of the special backslash strings that doesn't get talked about very much - K - but is quite powerful.
</p>
<blockquote>
One backslash sequence that doesn't get much attention is K. What this handy little assertion does is match the position of whatever string comes before it in the pattern, then it in essence resets the match. At that point it starts a new match with whatever comes after K from the current location in the subject string.
</blockquote>
<p>
They include a series of PHP code examples showing how use can use it to work around some of the issues with lookbehind assertions. They also include a few benefits and drawbacks of using them over lookbehinds.
</p>]]></description>
      <pubDate>Tue, 25 Aug 2009 10:28:44 -0500</pubDate>
    </item>
  </channel>
</rss>
