Regular Expressions 101

Community Patterns

Match the start of a link.

1

Regular Expression
PCRE2 (PHP >=7.3)

/
https?:\/\/[\/\\]*(www\.)?
/
gm

Description

https:// http:// https://// https://///
https:////

The reason I include [/\]* is because some links like: https:///////www.google.com actually work.

Submitted by anonymous - 3 years ago