|
|
@ -1,3 +1,5 @@ |
|
|
|
import tlds from 'tlds'; |
|
|
|
|
|
|
|
// Reusables
|
|
|
|
const escapeChar = `\\`; |
|
|
|
const notWhitespaceOrComma = `[^${escapeChar}s,]`; |
|
|
@ -6,7 +8,7 @@ const WhitespaceCommaDotOrEndOfLine = `[${escapeChar}s,.]|$`; |
|
|
|
const number = `[0-9]`; |
|
|
|
|
|
|
|
// Sections
|
|
|
|
const hostname = `(${notWhitespaceOrComma}*${escapeChar}.(com|ninja))`; |
|
|
|
const hostname = `(${notWhitespaceOrComma}*${escapeChar}.(${tlds.join('|')}))`; |
|
|
|
const ip = `(${number}{1,3}${escapeChar}.){3}${number}{1,3}`; |
|
|
|
const optionalPortNumber = `(:${number}+)?`; |
|
|
|
const optionalSlash = `(${escapeChar}/(${notWhitespaceCommaOrDot}*)?)?`; |
|
|
|