Community Patterns

Community Library Entry

0

Regular Expression
Created·2022-08-10 14:19
Flavor·PCRE2 (PHP)

/
^(?!graphql|dashboard|telescope)[\/\w-]*
/
gm
Open regex in editor

Description

When creating a SPA we could capture all routes except some.

Needed this for Laravel

Route::get('/{any?}', function () { return 'Not captured'; })->where('any', '^(?!graphql|dashboard|telescope)[/\w\·-]*');

Submitted by aldo-f