Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
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

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 - 2 years ago (Last modified 2 years ago)