Theres gotta be a simpler way of writing this, right?

function onlySmallLetters(str) {
var removeNumbers = str.replace(/\d/g, “”);
var removeSpaces = removeNumbers.replace(/\s/g, “”);
var removeSymbols = removeSpaces.replace(/\W/g, “”);
var removeUnderScore = removeSymbols.replace(/[_]/g, “”);
return (removeUnderScore.toLowerCase());

Is there a way to compact these RegExp into one line?


Ahh do I feel dumb :stuck_out_tongue:
Funny thing is that before writing that large block of code, I typed:


but the slashes and brackets were breaking it so I searched W3 school’s site to learn about metacharacters … and I never thought to place them all in the square brackets like I initially tried out with all those charcters, SMH.