JSFiddle - React, Tailwind, and code Playground

HTML

<div id="output"></div>

JavaScript

var remote, source;

remote = 'budgets-closed';

if (remote.match(/^[a-z]+/g) == 'budgets') {
    mode = remote.match(/\-(\w+)/g);
    source = '/panel/budgets/data/' + mode[0].substring(1);
}

$('#output').html(source);