Regex macro fails with line breaks

I have a macro that gets variables from the user and uses them to create a regex find/replace dynamically. (See image below.)

It works fine except when I put a \n or \r as the %Variable%Regex Change% variable. However, when I don't set those values dynamically—if I plug them into the find/replace fields statically—the macro works fine.

Any ideas?