JSFiddle - React, Tailwind, and code Playground
HTML
<span id="first"></span><br/>
<span id="second"></span>
JavaScript
var works = new RegExp('^[ +-]*$', 'gim');
var doesntWork = new RegExp('^[ -+]*$', 'gim');
document.getElementById('first').innerText = works.source + ' evaluating \'-\': ' + works.test('-');
document.getElementById('second').innerText = doesntWork.source + ' evaluating \'-\': ' + doesntWork.test('-');