in reply to Localized Backreferences, If Statements & Blocks

Here is a good discussion of this phenomenon: Scope of RegEx Vars