How can I check it with regular Expression?
<p>I have a long input string that contains certain field names in-bedded in it.  For instance:</p>

<pre class="lang-none prettyprint-override"><code>SELECT some-name, some-name FROM [some-table] WHERE [some-column] = 'some-value'
</code></pre>

<p>The actual field name may change, but it is always in the form of <code>word-word</code>.  I need to perform a regex replace on the string so that the output will look like this:</p>

<pre class="lang-none prettyprint-override"><code>SELECT some - name, some - name FROM [some-table] WHERE [some-column] = 'some - value'
</code></pre>

<p>In other words, when the field name is enclosed in square-brackets, it should be left untouched, but when it is not, spaces should be inserted on either side of the dash. There are no nested square brackets and the reserved word could be one or more in the string.</p>