I want to find any string repetition. I have following code:
let match: Object;
let repetition: ?string;
while ((match = /(.+?)\1+/g.exec(string)) !== null && repetition === null) {
repetition = match[1];
}
It finds 'abc' replication in 'weabcabcjy', but it also finds 'll' in 'all'. I would like to have regex to limit minimal length of replication to 2 characters. It means it compare always minimally 2 characters against others two.