Community Patterns

Community Library Entry

1

Regular Expression
Created·2015-11-13 09:00
Flavor·PCRE (Legacy)

/
((?:(?:https?):\/\/)?(?:\S+(?::\S*)?@)?(?:(?:[a-z0-9][a-z0-9\-]*?[a-z0-9]+)(?:\.(?:[a-z0-9\-])*[a-z0-9]+)*(?:\.(?:[a-z]{2,})(:\d{1,5})?))(?:\/[^\s]*)?)(?:[ ]+[^< ]|\Z|\n)
/
ig
Open regex in editor

Description

Will extract URLs from text string if they have a space or line ending at the end and are not wrapped inside a string delimiter

Submitted by pip