Community Patterns

Community Library Entry

0

Regular Expression
Created·2022-11-07 14:36
Updated·2022-11-12 17:32
Flavor·PCRE2 (PHP)

/
((?:https?:\/\/)?(?:www\.)?(?:\S+)?(?:\.\S+)?\.(?:com|io)(?:\/\S+)?(?:\?[\S]+)?)
/
gm
Open regex in editor

Description

PS: It catches undesired strings if they have a dot in the middle, for example "test.test", because it's not checking if ".test" is a real domain extension.

You can improve the solution by checking all the possible domain extensions: https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains

Submitted by Vini Pereira