News Feed
Jobs Feed
Sections




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

Sameer Borate:
Constructing hard regular expressions with VerbalExpressions
August 12, 2013 @ 11:19:40

Sameer Borate has an post to his site sharing a library that could help you in creating more complex regular expressions a bit more simply. He introduces the VerbalExpressions library and an example of its use.

Most newbie (and some seasoned) programmers have difficultly constructing Regular Expressions. Many a times one needs to create a Regexp quickly to test a a particular piece of code. However, not being comfortable withe Regexps can be a problem. VerbalExpressions is a PHP library that enables you to construct regular expressions using natural language like constructs. Think of it like a DSL for building Regexps.

His example checks to see if a given string is a valid URL (yes, filter_var can do this too, but stick with him). He shows how to use the library's fluent interface to construct the regexp, export it as a string or just pass in the object as the regular expression in something like preg_match. The VerbalExpressions library is hosted over on Github.

0 comments voice your opinion now!
verbalexpressions regularexpression regexp library

Link: http://www.codediesel.com/php/constructing-hard-regular-expressions-with-verbalexpressions

blog comments powered by Disqus

Similar Posts

Dave Marshall's Blog: Landing a PHP job Part 1: Technical Knowledge and Skills

PHP.net: PHP 5.4.14 and PHP 5.3.24 released!

NETTUTS.com: Twitter Emulation Using MooTools 1.2 and PHP

Christopher Kunz's Blog: Building PHP with cURL and libmysqlclient5

Paul Jones' Blog: Solar 0.21 and 0.22 released in quick succession


Community Events











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


hack composer symfony2 framework component performance package introduction project unittest release database example language security hhvm application facebook install podcast

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