Last updated 4 years ago
Was this helpful?
remove all question mark '!' from input
extract last question mark string from input
return process-1 + process-2
const remove = (s) => s.replace(/!/g, '') + (s.match(/!+$/) ? s.match(/!+$/)[0] : '');