Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
PCRE (PHP <7.3)

/
(?:^|(?<=\/)) (?:[^\s.\/]+|\.(?!\.\/))++ \/\.\.\/
/
gmix

Description

Example usage: $Path = preg_replace('/(?:^|(?<=/))(?:[^\s./]+|.(?!./))++/..//i', '', $Path);

Submitted by Mr.Deek & +OnlineCop - 9 years ago