$ perl -Mre=debug -e '$_="a";s/(?=(a))/b/g'
Compiling REx "(?=(a))"
Final program:
1: IFMATCH[0] (11)
3: OPEN1 (5)
5: EXACT (7)
7: CLOSE1 (9)
9: SUCCEED (0)
10: TAIL (11)
11: END (0)
minlen 0
Matching REx "(?=(a))" against "a"
0 <> | 0| 1:IFMATCH[0](11)
0 <> | 1| 3:OPEN1(5)
0 <> | 1| 5:EXACT (7)
1 <> | 1| 7:CLOSE1(9)
1 <> | 1| 9:SUCCEED(0)
| 1| SUCCEED: subpattern success...
0 <> | 0| 11:END(0)
Match successful!
Matching REx "(?=(a))" against "a"
0 <> | 0| 1:IFMATCH[0](11)
0 <> | 1| 3:OPEN1(5)
0 <> | 1| 5:EXACT (7)
1 <> | 1| 7:CLOSE1(9)
1 <> | 1| 9:SUCCEED(0)
| 1| SUCCEED: subpattern success...
0 <> | 0| 11:END(0)
END: Match possible, but length=0 is smaller than requested=1, failing!
1 <> | 0| 1:IFMATCH[0](11)
1 <> | 1| 3:OPEN1(5)
1 <> | 1| 5:EXACT (7)
| 1| failed...
| 0| failed...
Match failed
Freeing REx: "(?=(a))"