Hey everyone! I’m working on the Palindrome Checker project
and running into an issue with my regex pattern.
My code strips spaces and punctuation like this:
function palindrome(str) {
let cleanStr = str.toLowerCase().replace(/[^a-z0-9]/g, ‘’);
return cleanStr === cleanStr.split(‘’).reverse().join(‘’);
}
It passes most test cases, but fails on strings with
underscores. Can anyone point out what I’m missing?
Thanks in advance!
