Check for Palindromes condition issue

Tell us what’s happening:
I have been able to satisfy all conditions save 1 i.e. “0_0 (: /-\ :slight_smile: 0-0”. According to the exercise, this should return true but I think it should return false since on reversing it, it becomes “0-0 ): -/ :frowning: 0_0”. Can someone help me with this?

Your code so far

var arr = [];
var str1 = "";
// var test = /[' ']/
function palindrome(str) {
  // Good luck!
  str = str.toLowerCase();
  str = str.replace(/[' '|_|,|.]/gi, '');
  arr = str;
  arr = arr.split('');
  str1 = arr.join('');
  if (str1 == str) 
    return true;
    return false;

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

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36.

Link to the challenge:

The input “0_0 (: /-\ :slight_smile: 0-0” should return true because we need to only take the numbers and characters so the inputed string would become "0000"
which is a pallindrome.

str=str.replace(/[^a-zA-Z0-9]/g, ‘’); //will take only numbers and alphabets and ignore others.
instead of
str = str.replace(/[’ '|_|,|.]/gi, ‘’);

It worked. That was pretty neat. So I guess that caret stands for not(!) as in anything apart from a-z or A-Z or 0-9 would be ignored? But shouldn’t that caret be outside the bracket ^[a-zA-Z0-9] to include all 3 regexes or that’s just the way it is written[^a-zA-Z0-9]?

[abc] -This is used for finding any character between the brackets and
[^abc] -This is for finding any character NOT between the brackets

These are syntaxes and there must be some reason for using it that way, may be it was used to not make it confusing with below expression but am not sure :neutral_face:

^abc - Matches any string with abc at the beginning of it.