Regular Expressions 101

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

Open Workspace
  • PCRE2 (PHP)
  • Match
4

Regular Expression

/
(?: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