A little hand with str.replace()?

A little hand with str.replace()?
0

#1
function palindrome(str) {
  // Good luck!
 var re=",+-#!¡¿?$%i."/gi/
 var newString= str.replace(re," ");

return re;
}
 palindrome("Je,su.s");

Okk,so this is what I´ve done so far. I´m trying to replace those symbols put together in a chunk with blank space,so that instead of “Je,su.s” it would be “Jesus”.Thanks for reading


#2

There are “tokens” in regex which represent things like “any digit” or “any non-word character” I recommend looking into these so that you don’t have to list every single special character that you can think of.
https://regex101.com/ is a great place to test regex and also has a good explanation of your pattern and a place to look at available tokens.


#3

Hey Ariel,thank you for the link. I´ll check it out. I think I wouldn´t have figured it out myself