A small criticism: You should use $replacecs() instead of $replace(), as the \Q...\E sequence is case-sensitive. An \e would not end the escape sequence, as you can see here:

Code:
//echo -a $regex(\e,/^\Q\e\E$/)