laravel/laravel — pull request #1436 by j20 (2012-11-12 07:05:00+00:00)
Title: Updated laravel/uri.php

Fixed so that URL's work as expected and those with extraneous slashes (e.g. laravel.com////about or laravel.com/about////) 404 as desired.

See this comment for more details of both this solution and a non-regex solution with speed benchmark results of the both. In sum, they benchmark at very nearly the same speed, so this version was chosen because it's cleaner and more elegant. https://github.com/laravel/laravel/issues/1412#issuecomment-10278667