Regular Expressions 101

Community Patterns

Community Library Entry

3

Regular Expression
PCRE (PHP <7.3)

/
^(?<protocol>[a-z\-]+)?:?(?<slash>\/\/)?(?<host>[a-zA-Z0-9\.]+)?(?P<port>:\d+)?$
/
gm

Description

Best Full URL Regex to match URL, This is simple and can match 64K of url regex under 77ms

Regex Matches All Below and more:

Submitted by divineniiquaye - 4 years ago