Regular Expressions 101

Community Patterns

1...34567...902

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(https:\/\/|http:\/\/).+\..+\/|(http\:\/\/|)localhost(\:(\d+$))
/
gmU

Description

Searches the string for valid URLs. Includes HTTP, HTTPS, and localhost with it's port.

Submitted by Evan Wilson - 2 years ago