Introducing BunnyRegex: easy regular expressions, and mini-languages inside of PHP: Here’s a great little regex library for PHP that uses a dead-simple syntax that someone should have thought of way, way before this.
include(“BunnyRegex.php”); $pattern = new BunnyRegex();
$pattern->bol() // ^ ->digit() // \d ->exactly(4) // {4} ->string('/') // / ->digit() // \d ->exactly(2) // {2} ->string('/') // / ->digit() // \d ->exactly(2) // {2} ->eol(); // $
$pattern->match('2006/02/28’); // returns true $pattern->numberOfMatches('2006/02/28’); // returns 1