Regular Expressions 101

Community Patterns

Community Library Entry

4

Regular Expression
PCRE2 (PHP >=7.3)

/
(?:http[s]?:\/\/.)?(?:www\.)?[-a-zA-Z0-9@%._\+~#=]{2,256}\.[a-z]{2,6}\b(?:[-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)
/
gm

Description

Match any url in text or html (http, https)

Submitted by Jérémy Munsch - 3 years ago