Regular Expressions 101

Community Patterns

Community Library Entry

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 - 9 years ago