You can edit a language injection in your code using a dedicated editor.

Start typing a regular expression, press &shortcut:ShowIntentionActions; and click Edit RegExp Fragment. The regular expression opens in a separate tab in the editor, where you can type backslashes as is.

All changes are synchronized with the original regular expression, and escape characters are presented automatically.

Edit a regular expression