Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
(?<!@)\b((http(s)?:\/\/)?((\d+)\.)?[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})(\/[^\s]*)?\b
/
gm

Description

Match the web URL, like https://xxx.com or xxx.com, not matching the email or the ip address

Submitted by Hughie - a month ago