Js regular Filter problem

how to drop non-numeric characters except X from the string in Filter,
for example:
var str = "te13214545xsdf456"
expected result 13214545x456

Mar.03,2021

var str = "te13214545xsdf456";
console.log(str.replace(/[^x\d]/g,''));
Menu