Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
((https?:\/\/)|(\/)|(..\/))(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?
/
gm

Description

Check URL starts with HTTP/HTTPS and has content after (e.g. https://www.test.com)

Submitted by anonymous - 4 years ago