I am trying to replace the value of a string in JavaScript, so I have the following lines of code in a function:
result = result.replace('start\introduction', 'index');
console.log(result.search('start\introduction'));
var patt = new RegExp("start\introduction");
console.log(patt.exec(result));
console.log(result)
However, the console output is this:
-1
null
C:\Users\George\Source\Repos\docs\docs\source\start\introduction.md
The string contains the value being searched for, so why are both regexp and search returning not found?