Variable as RegEx not working

Dear Keyboard Maestros,

I'm currently encountering a very strange behaviour, which I don't understand. I'm using a variable within a Search and Replace Action to extract this variable + additional lines.

Here's a RegEx example:


(for "safety" reasons, I escaped all special characters)

The variable is taken from a .txt file and filtered to remove any styles.
Unfortunately, the Regex within the macro fails - even though it works on Regex101.

If I set the variable manually with the respective KM Action, it works. If I set the variable within the Search and Replace Action to the %SystemClipboard% and copy the search string from Regex101.com, it also works.

It seems like there's some "hidden" formatting at work, which I can't figure out. Or am I simply doing something wrong here?

Thanks a lot for your help!

In order for us to help you, please upload your macro .