I’m looking to capture groups of equal size, but there’s more than just one unary character in my string (eg the usual (.*)1
trick doesn’t work because the second half is different from the first)
I have a loop that just tries ^(.{1})(.{1})$
with every number, but that’s very cumbersome in sed, and I feel like there should be a more elegant way. This specific time my regex flavor is sed ERE
s, but I’ve encountered this problem before when working with other flavors as well so if you have an answer in a different flavor I would appreciate that as well. This comment shows that it’s at least possible with some flavors: ^(?:.(?=.*?((?(1).1|.)$)))+K1