Regular Expressions 101

Community Patterns

Search for URL

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 - a year ago