News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Nikita Popov's Blog:
The true power of regular expressions
June 15, 2012 @ 08:42:57

Nikita Popov has a new (language agnostic) post to his blog today about one of the most powerful things you can use in your development - something that a lot of developers don't understand the true power of - regular expressions.

As someone who frequents the PHP tag on StackOverflow I pretty often see questions about how to parse some particular aspect of HTML using regular expressions. A common reply to such a question is: "You cannot parse HTML with regular expressions, because HTML isn't regular. Use an XML parser instead." This statement - in the context of the question - is somewhere between very misleading and outright wrong. What I'll try to demonstrate in this article is how powerful modern regular expressions really are.

He starts with the basics, defining the "regular" part of "regular expression" (hint: it has to do with predictability) and the grammar of the expressions. He talks about the Chomsky hierarchy and how it relates to the "regular" as well as a more complex mapping of expression to language rules. He talks about matching context-free and context-sensitive languages and unrestricted grammars as well.

0 comments voice your opinion now!
power regular expression define theory context


blog comments powered by Disqus

Similar Posts

PHPBuilder.com: BitMasks: Emulate Unix Permissions in PHP (Quickly)

Vidyut Luther\'s Blog: Where do you \"define\" your environment/global settings?

Felix Geisendorfer's Blog: Validating the cleaned output of HtmlHelper::dateTimeOptionTag()

Matthew Weir O'Phinney's Blog: Automating PHPUnit2 with SPL

SitePoint PHP Blog: The Joy of Regular Expressions [1]


Community Events





Don't see your event here?
Let us know!


list language framework release artisanfiles security composer symfony tool community series conference opinion laravel podcast interview introduction voicesoftheelephpant version library

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework