Regular Expressions 101

Community Patterns

URL Path Validation

1

Regular Expression
PCRE (PHP <7.3)

/
^\/(?!.*\/\/)([a-zA-Z-\/]+)$
/
gim

Description

Validates an url path that must begin with '/' and not contain special characters or repeated '/' [forward slashes]

Submitted by rochmit10 - 8 years ago