Community Patterns

Community Library Entry

0

Regular Expression
Created·2022-06-29 09:42
Updated·2022-10-12 09:17
Flavor·ECMAScript (JavaScript)

/
^(?:(?:ftp|https?):\/\/)?(?!0\.0\.0\.0$)(?:(?:(?:1?\d\d?|2[0-4]\d|25[0-5])(?:\.(?!$))?){4}|(?:[a-zA-Z\d]\.|[a-zA-Z\d](?:(?![-.]{2})[a-zA-Z\d-]){0,63}?[a-zA-Z\d]\.){1,63}?[a-z]{2,63})(?:[:/].*)?$
/
gm
Open regex in editor

Description

Domain can be an IP address, except 0.0.0.0

Domain with length of 1 accepted

Only acceptable symbol in Domain is "-" (hyphen) Not allowed in start, end or twice in a row (same for "." (dot))

Submitted by Artur