I'm far from considering myself well-informed on RegEx matters, but the way I see it, the RegEx engine expects
real code in
(?{ code }) and
(??{ code }) constructs and not a RegEx. See
perlre for further reference. The reason why the fourth example works would then be that you told the compiler the 'code' was a RegEx. Just use one alternative at a time and you'll be fine.
Hope this helped,
CombatSquirrel.
P.S.: What are you trying to do with your code? I don't see the sense of embedding one of the above constructs into the other. Maybe we can find a work-around if you give specifics of your problem.