Regular Expressions 101

Community Patterns

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