Hey. I’m trying to replace everything that starts with marker[0] and goes until \n but it doesn’t work. I’ve checked the regexp and it works just as I want but the input.replace doesn’t work. Can you pls help me with this one?
function solution(input, markers) {
let regexp1 = '/'+markers[0]+'.*?(?=\\\\n)/gm';
return input.replace(regexp1,'a')
};
solution("apples, plums % and bananas\npears\noranges !applesauce", ["%", "!"]);
function solution(input, markers) {
let regexstring = markers[0]+'.*?(?=\\\\n)';
let regexp1 = new RegExp(regexstring, 'gm');
return input.replace(regexp1,'a');
};
solution("apples, plums % and bananas\npears\noranges !applesauce", ["%", "!"])