I've got this JavaScript function:
value.replace(/[\\\*\+\^\?\$\[\]\{\}\-]/g, '\\$&');
It's designed to replace:
* , + , ^ , ? , & , { , }
with:
\* , \+ , \^ , \? , \& , \{ , \}
However, when I have .+
, I don't want it to be replaced with .\+
What adjustments do I need to make to my regex pattern?