Regular Expressions 101

Community Patterns

URL path element match (case-insensitive)

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(?i)(?<=\/)pathElement(?=\/)
/
gm

Description

A regular expression that matches a specific path element in an URL (case-insensitive).

Useful for apache LocationMatch-Direktive, e.g. <LocationMatch "(?i)(?<=\/)pathElement(?=\/)">

Submitted by René Link - 3 years ago