JSFiddle - React, Tailwind, and code Playground

HTML

<script>
    var string = "match    the start using. Remove the extra space between match and the";
    alert("Before-->" + string);
string = string.replace(/\s+/g, " ");
    alert("After-->" + string);
</script>