If there is an injection of some language in your code, you can edit it in a dedicated editor.

In particular, it is possible to edit regular expressions. Just start typing a regular expression, then press &shortcut:ShowIntentionActions; and choose Edit RegExp. 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 escapes are presented automatically. When ready, just press &shortcut:EditorEscape; to close the regular expression editor.