JS Regular Expression - add whitespaces around / with no surrounding whitespaces : <p>I need to implement a method in Javascript adding whitespaces around / with no surrounding whitespaces.</p>

<p>Example:
<code>hello/this /is a/ complicated/task</code> should result in <code>hello / this /is a/ complicated / task</code></p>

<p>M approach so far:</p>

<pre><code>inputString.replace(new RegExp(/([^\s])\/([^\s])/), '$1 / $2');
</code></pre>

<p>But this replaces only the first occurance. How does one make it replace all?</p>
