UNPKG

ioc-extractor

Version:

IoC (Indicator of Compromise) extractor

23 lines (20 loc) 551 B
import { idnPrefix, labelLetters, nonStrictTld, oneOrMoreLabel, strictTld, zeroOrMoreLabel, zeroOrMoreLabelWithHyphen } from "./chunk-A2GVSYTG.js"; // src/aux/domain.ts function domainRegex(options = { strict: true }) { const tld = options.strict ? strictTld : nonStrictTld; const regex = `(?=[${labelLetters}.\\-]{1,252}\\.(${tld})\\b)((${idnPrefix}${zeroOrMoreLabel}|${oneOrMoreLabel})((?!.{0,63}--)${zeroOrMoreLabelWithHyphen}[${labelLetters}])?\\.)+(${tld})\\b`; return new RegExp(regex, "gi"); } export { domainRegex };