Hacker News new | ask | show | jobs
by pygy_ 3022 days ago
https://github.com/pygy/compose-regexp.js is another option (800 bytes mingzipped):

    const {sequence, suffix} = composeRegexp;
    const maybe = suffix("?");
    const oneOrMore = suffix("+");

    const urlMatcher = sequence(
      /^/,
      "http"
      maybe("s"),
      "://",
      maybe("www."),
      oneOrMore(/[^ ]/),
      /$/
    );