Regular Expressions 101

Community Patterns

url and path match with or without http|https

0

Regular Expression
PCRE (PHP <7.3)

/
^(https?:\/\/)?([\da-z-]+\.)+([a-z]{2,6})?(\/([a-z0-9+\$_-]\.?)+)*\/?$
/

Description

this is the most perfect pattern I reach for url with query or anchor

Submitted by Gehad Mohamed - 9 years ago