2 ms·
https://github.com/pygy/compose-regexp.js https://github.com/pygy/compose-regexp.js is another option (800 bytes mingzipped): const {sequence, suffix} = co
by pygy_ 9y ago
https://github.com/pygy/compose-regexp.js 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(/[^ ]/),
/$/
);