+ 2
help with JavaScript
how to replace a letter at the end of a word using regular expressions?
3 Answers
+ 2
You Can use replace(/.$/, the new letter)
+ 2
const replaceAll = (str, replace) => str.replaceAll(/[^\s.]\b/g, replace);
let rA = replaceAll('How Are You', '*');
console.log('replaceAll:', rA);
https://www.sololearn.com/compiler-playground/Wq9ZB566lZtm
0
if you know , please say me