I have the following code:
this.directives.forEach(function (dir) {
var myVar = "hello";
if (control.text !== myVar) {
cleanUp(control);
if (dir)
setUpControl(myVar, dir);
control = dir;
}
});
And need to replace everything that is between: if (control !== myVar) {
and }
. I have followed this answer and tried the following:
sed -i 's/(if \(control\.text !== myVar\) \{).*?(\})/\1 REPLACEMENT_STRING \2/is' myFile.js
which returns
sed: 1: "s/(if \(control\.text ! ...": RE error: invalid repetition count(s)