There is a code:
var task; task = '(X^2+X^2)+X^2'; task = task.replace(/(^|\+)X\^2\b/g, '+1X^2'); at the output, the task will be (X^2+1X^2)+1X^2 .
How to make it so that at the output task was equal to (+1X^2+1X^2)+1X^2 ? I just need to do so that he read the bracket, but did not remember it.