Regular Expressions 101

Community Patterns

URL: Simple domain matcher

0

Regular Expression
PCRE (PHP <7.3)

~
(?: (https?) :/{2} )? ( \w+ (?:\.\w+)+ )
~
gxu

Description

Matches the protocol (http/https) if available and full domain name.

Submitted by OnlineCop - 7 years ago