JSFiddle - React, Tailwind, and code Playground

HTML

<div id="hello" class="p70 foo bar"></div>

JavaScript

$("#hello").removeClass (function (index, className) {
    return (className.match (/\bp-\S+/g) || []).join(' ');
});

console.log($("#hello")[0].className);