Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^([a-zA-Z]+):\/\/(-\.)?(([^\s\/?\.#\-]+|([^\s\/?\.#\-]-[^\s\/?\.#\-]))\.?)+(\/[^\s]*)?$
/
mg

Description

inspired by https://mathiasbynens.be/demo/url-regex and the pattern from @imme_emosol

Submitted by Elmervc - 9 years ago