Paste: 1
Author: | 1 |
Mode: | javascript |
Date: | Thu, 1 Sep 2022 21:45:57 |
Plain Text |
function matchOverlap(input, re) {
var r = [],
m;
if (!re.global) re = new RegExp(
re.source, (re + '').split('/').pop() + 'g'
);
while (m = re.exec(input)) {
re.lastIndex -= m[0].length - 1;
r.push(m[0]);
}
return r;
}
function algorithm(pattern, s) {
const VOWELS = 'aeiouy'
if (pattern.match('[^01]'))
throw new Error('only 0 and 1 allowed in pattern')
else if (s.match('[^a-z]'))
throw new Error('only a-z allowed in s')
const generatedRegex = new RegE
New Annotation