I have a string only made by 0 and 1, and I need to find a sub string that starts with one 1, and ends with another cascade of 1s, each match of 1 the consecutive 1 increases by one.
For example, 0101101011101 would catch 1011010111.
I tried
(?:(1(?(1)\1)).*?)+
but it doesn't work.
| input | groups | output |
|---|---|---|
01 |
0[(1)] |
1 |
1001111 |
[(1)00(11)]11 |
10011 |
010011111 |
0[(1)00(11)(111)] |
10011111 |
0100111110001110 |
0[(1)00(11)(111)]0001110 |
10011111 |
0100111011001110 |
0[(1)00(11)101100(111)]0 |
10011101100111 |
0100111110011110 |
0[(1)00(11)(111)00(1111)]0 |
10011111001111 |