rabbitrun
9/4/2016 - 8:18 PM

Palindromes and regexp...hooray!

Palindromes and regexp...hooray!

function palindrome(str) {
  // Good luck!
  var re = /[\s\!\@\#\$\%\^\&\*\(\)\+\=\-/\\\\:\_]/g,
      cleanStr,
      revStr;
  cleanStr = str.toLowerCase().replace(re, "");
  revStr = cleanStr.split("").reverse().join("");
  if (cleanStr === revStr) {
      return true;
  } else { console.log(cleanStr); }
}



palindrome("0_0 (: /-\ :) 0-0");