Palindrome Checker: awkward but functional answer?

Hi all!

I fulfilled all the cases of this challenge, but my answer looks a little awkward when comparing to the official solution. Is this approach ok?

const palindrome = (str) => {
  let regex = /\w+/g;
  let newStr = str.replace(/_/g, "").toLowerCase().match(regex).join("");
  let inverted = newStr.split("").reverse().join("");
  return inverted === newStr;
}

I’ve blurred your solution. Please don’t disclose working solutions on the forum.

I am not sure what you mean by “ok” but it looks good so far.

Can you add a link to the exercise so we can take a look at its requirements?