Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

%
(?<=/)(?:[^/]*/){2}\K(.*)(?=/[^/]*)
%
gm

Description

Used to shorten a path before printing it. Useful to know where we are without printing a 10km path to the screen !

Submitted by totok - 2 years ago