Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^(?:(https?):)?(\/\/.*\.[^\/]+)$
/
gm

Description

Regex for http:/https: or only domain url stating with a slash

Examples: https://example.domain http://example.domain //example.domain //example.com

Submitted by divineniiquaye - 4 years ago